Changeset 564


Ignore:
Timestamp:
01/23/06 02:56:48 (18 years ago)
Author:
mattausch
Message:
 
Location:
trunk/VUT/GtpVisibilityPreprocessor
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env

    r562 r564  
    3030VssPreprocessor { 
    3131        samplesPerPass  100000 
    32         initialSamples 1800000 
     32        initialSamples 1200000 
    3333        vssSamples 0 
    3434        vssSamplesPerPass 500000 
     
    172172ViewCells { 
    173173        loadFromFile false 
    174         exportToFile true 
     174        exportToFile false 
    175175        #type kdTree 
    176176        #type vspKdTree 
     
    186186                 
    187187        delayedConstruction false 
    188                  
    189                  
     188        pruneEmptyViewCells false 
     189        processOnlyValidViewCells false 
     190         
    190191        PostProcess { 
    191192                # how much samples are used for post processing 
     
    304305                #maxAccRayLength        100 
    305306                 
    306                 maxViewCells            1000 
     307                maxViewCells            10000 
    307308                 
    308309                # used for pvs criterium 
     
    320321                # x3d visualization of the split planes 
    321322                exportSplits true 
     323                exportMergedViewCells false 
    322324        } 
    323325         
     
    326328                minViewCells 110 
    327329                useRaysForMerge false 
     330                exportMergeStats false 
    328331        } 
    329332} 
  • trunk/VUT/GtpVisibilityPreprocessor/src/Environment.cpp

    r563 r564  
    12661266                "false"); 
    12671267 
    1268  
     1268        RegisterOption("ViewCells.pruneEmptyViewCells", 
     1269                optBool, 
     1270                "-view_cells_prune_empty_view_cells", 
     1271                "false"); 
     1272 
     1273        RegisterOption("ViewCells.processOnlyValidViewCells", 
     1274                optBool, 
     1275                "-view_cells_process_only_valid_view_cells", 
     1276                "false"); 
     1277         
    12691278        /************************************************************************************/ 
    12701279        /*                         Render simulation related options                        */ 
     
    18481857                "vsp_bsp_max_static_mem=",  
    18491858                "8.0"); 
    1850          
     1859 
     1860        RegisterOption("VspBspTree.Visualization.exportMergedViewCells", 
     1861                optBool,  
     1862                "vsp_bsp_viz_export_merged_viewcells=",  
     1863                "false"); 
     1864 
     1865        RegisterOption("VspBspTree.PostProcess.exportMergeStats", 
     1866                optBool,  
     1867                "vsp_bsp_viz_export_merge_stats=",  
     1868                "false"); 
     1869 
    18511870        ////////////////////////////////////////////////////////////////////////////////// 
    18521871} 
  • trunk/VUT/GtpVisibilityPreprocessor/src/Ray.cpp

    r487 r564  
    234234  dir = vssRay.GetDir() / len; 
    235235   
     236  intersections.clear(); 
    236237  if (vssRay.mTerminationObject) 
    237238        intersections.push_back(Intersection(len, vssRay.mTerminationObject, 0)); 
  • trunk/VUT/GtpVisibilityPreprocessor/src/RenderSimulator.cpp

    r551 r564  
    2828 
    2929RenderSimulator::RenderSimulator(ViewCellsManager *viewCellsManager): 
    30 Renderer(NULL, viewCellsManager) 
     30Renderer(NULL, viewCellsManager), 
     31mObjRenderCost(0.0f),  
     32mVcOverhead(0.0f),  
     33mMoveSpeed(0.0f), 
     34mOnlyValid(false) 
    3135{} 
     36 
    3237 
    3338RenderSimulator::RenderSimulator(ViewCellsManager *viewCellsManager, 
     
    3843mObjRenderCost(objRenderCost),  
    3944mVcOverhead(vcOverhead),  
    40 mMoveSpeed(moveSpeed) 
     45mMoveSpeed(moveSpeed), 
     46mOnlyValid(false) 
    4147{ 
    4248} 
     49 
    4350 
    4451void RenderSimulator::SetObjectRenderCost(const float objRenderCost) 
     
    4653        mObjRenderCost = objRenderCost; 
    4754} 
     55 
     56 
     57void RenderSimulator::SetRenderOnlyValid(const bool renderOnlyValid) 
     58{ 
     59        mOnlyValid = renderOnlyValid; 
     60} 
     61 
    4862 
    4963void RenderSimulator::SetVcOverhead(const float vcOverhead) 
     
    7488        { 
    7589                ViewCell *vc = *it; 
     90 
     91                if (mOnlyValid && !vc->GetValid()) 
     92                        continue; 
    7693 
    7794                // probability of view cell 
  • trunk/VUT/GtpVisibilityPreprocessor/src/RenderSimulator.h

    r477 r564  
    7878        bool RenderScene(); 
    7979 
     80        /** If only valid view space should be rendered. 
     81        */ 
     82        void SetRenderOnlyValid(const bool onlyValid); 
     83 
    8084protected: 
    8185 
     
    9599        /// Simulation statistics 
    96100        SimulationStatistics mSimulationStatistics; 
     101 
     102        /// if only valid view space should be rendered 
     103        bool mOnlyValid; 
    97104}; 
    98105 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCell.cpp

    r551 r564  
    8383        if (pvsSize < vcStat.minPvs) 
    8484                vcStat.minPvs = pvsSize; 
     85 
     86        if (!mValid) 
     87                ++ vcStat.invalid; 
    8588} 
    8689 
     
    100103void ViewCell::SetValid(const bool valid) 
    101104{ 
    102         mValid = true; 
     105        mValid = valid; 
    103106} 
    104107 
     
    138141        app << "#N_MAXLEAVES ( maximal number of leaves per view cell )\n" << maxLeaves << endl; 
    139142         
     143        app << "#N_INVALID ( number of invalid view cells )\n" << invalid << endl; 
     144 
    140145        app << "========== End of View Cells Statistics ==========\n"; 
    141146} 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCell.h

    r547 r564  
    4545        int maxLeaves; 
    4646 
     47        int invalid; 
     48 
    4749    // Constructor 
    4850        ViewCellsStatistics() 
     
    6466                leaves = 0; 
    6567                maxLeaves = 0; 
     68                invalid = 0; 
    6669        } 
    6770 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp

    r563 r564  
    2727mViewCellsFinished(false), 
    2828mMaxPvsSize(9999999), 
    29 mMinPvsSize(1), // only empty view cells are invalid 
     29mMinPvsSize(0), // one means only empty view cells are invalid 
    3030mMaxPvsRatio(1.0) 
    3131{ 
     
    4444mViewCellsFinished(false), 
    4545mMaxPvsSize(9999999), 
    46 mMinPvsSize(1), // only empty view cells are invalid 
     46mMinPvsSize(0), // one means only empty view cells are invalid 
    4747mMaxPvsRatio(1.0) 
    4848{ 
     
    5858        environment->GetBoolValue("ViewCells.Visualization.exportGeometry", mExportGeometry); 
    5959        environment->GetFloatValue("ViewCells.maxPvsRatio", mMaxPvsRatio); 
     60        bool emptyViewCells = false; 
     61        environment->GetBoolValue("ViewCells.pruneEmptyViewCells", emptyViewCells); 
     62        environment->GetBoolValue("ViewCells.processOnlyValidViewCells", mOnlyValidViewCells); 
     63 
     64        mMinPvsSize = emptyViewCells ? 1 : 0; 
    6065 
    6166        char buf[50]; 
    62  
    6367        environment->GetStringValue("ViewCells.Visualization.colorCode", buf); 
    6468 
     
    9195        preprocessor->GenerateVssRays(mConstructionSamples, vssRays); 
    9296        Construct(preprocessor->mObjects, vssRays); 
    93          
     97 
    9498        // add rays to output rays 
    9599        while (!vssRays.empty) 
     
    116120 
    117121 
    118 bool ViewCellsManager::CheckValidity(ViewCell *vc,  
    119                                                                          int minPvsSize,  
     122bool ViewCellsManager::CheckValidity(ViewCell *vc, 
     123                                                                         int minPvsSize, 
    120124                                                                         int maxPvsSize) const 
    121125{ 
    122126        if ((vc->GetPvs().GetSize() > mMaxPvsSize) || 
    123127                (vc->GetPvs().GetSize() < mMinPvsSize)) 
    124         {        
     128        { 
    125129                return false; 
    126130        } 
     
    130134 
    131135 
    132 void ViewCellsManager::SetValidity(ViewCell *vc,  
    133                                                                    int minPvs,  
     136void ViewCellsManager::SetValidity(ViewCell *vc, 
     137                                                                   int minPvs, 
    134138                                                                   int maxPvs) const 
    135139{ 
     
    179183  if (!ViewCellsConstructed()) 
    180184        return 0.0f; 
    181    
     185 
    182186  VssRayContainer::const_iterator it, it_end = rays.end(); 
    183187 
     
    309313 
    310314        //-- merge ray sets 
    311         stable_sort(front.mPiercingRays.begin(), front.mPiercingRays.end()); 
    312         stable_sort(back.mPiercingRays.begin(), back.mPiercingRays.end()); 
    313  
    314         std::merge(front.mPiercingRays.begin(), front.mPiercingRays.end(), 
    315                            back.mPiercingRays.begin(), back.mPiercingRays.end(), 
    316                            vc->mPiercingRays.begin()); 
     315        if (0) 
     316        { 
     317                stable_sort(front.mPiercingRays.begin(), front.mPiercingRays.end()); 
     318                stable_sort(back.mPiercingRays.begin(), back.mPiercingRays.end()); 
     319 
     320                std::merge(front.mPiercingRays.begin(), front.mPiercingRays.end(), 
     321                                   back.mPiercingRays.begin(), back.mPiercingRays.end(), 
     322                                   vc->mPiercingRays.begin()); 
     323        } 
    317324 
    318325        return vc; 
     
    429436{ 
    430437        mViewCells.clear(); 
    431          
     438 
    432439        CollectViewCells(); 
    433          
     440 
    434441        mViewCellsStats.Reset(); 
    435442        EvaluateViewCellsStats(); 
     
    449456  if (!ViewCellsConstructed()) 
    450457        return; 
    451    
     458 
    452459  VssRayContainer::const_iterator it, it_end = rays.end(); 
    453    
     460 
    454461  for (it = rays.begin(); it != it_end; ++ it) { 
    455462        AddSampleContributions(*(*it)); 
     
    489496{ 
    490497  ViewCellContainer viewcells; 
    491    
     498 
    492499  ray.mPvsContribution = 0; 
    493500  ray.mRelativePvsContribution = 0.0f; 
    494    
    495   // matt TODO: remove this!! 
    496   Ray hray(ray); 
    497   float tmin = 0, tmax = 1.0; 
    498    
    499   //hray.Init(ray.GetOrigin(), ray.GetDir(), Ray::LINE_SEGMENT); 
    500   if (!GetViewSpaceBox().GetRaySegment(hray, tmin, tmax) || (tmin > tmax)) 
    501         return 0.0f; 
    502    
    503   Vector3 origin = hray.Extrap(tmin); 
    504   Vector3 termination = hray.Extrap(tmax); 
     501 
     502 static Ray hray; 
     503        hray.Init(ray); 
     504        //hray.mFlags |= Ray::CULL_BACKFACES; 
     505        //Ray hray(ray); 
     506 
     507        float tmin = 0, tmax = 1.0; 
     508 
     509        if (!GetViewSpaceBox().GetRaySegment(hray, tmin, tmax) || (tmin > tmax)) 
     510                return; 
     511 
     512        Vector3 origin = hray.Extrap(tmin); 
     513        Vector3 termination = hray.Extrap(tmax); 
     514 
     515        CastLineSegment(origin, termination, viewcells); 
     516        //Debug << "constribution: " << (int)viewcells.size() << endl; 
     517        // copy viewcells memory efficiently 
     518        const bool storeViewcells = false; 
     519        if (storeViewcells) 
    505520 
    506521  CastLineSegment(origin, 
    507522                                  termination, 
    508523                                  viewcells); 
    509    
     524 
    510525  //Debug << "constribution: " << (int)viewcells.size() << endl; 
    511    
     526 
    512527  // copy viewcells memory efficiently 
    513528  const bool storeViewcells = !addRays; 
    514    
     529 
    515530  if (storeViewcells) 
    516         { 
     531  { 
    517532          ray.mViewCells.reserve(viewcells.size()); 
    518533          ray.mViewCells = viewcells; 
    519         } 
    520    
     534          } 
     535 
    521536  ViewCellContainer::const_iterator it = viewcells.begin(); 
    522    
    523    
     537 
     538 
    524539  for (; it != viewcells.end(); ++it) { 
    525540        ViewCell *viewcell = *it; 
     
    533548        ray.mRelativePvsContribution += contribution; 
    534549  } 
    535    
     550 
    536551  if (addRays) 
    537552        for (it = viewcells.begin(); it != viewcells.end(); ++it) { 
     
    623638 
    624639 
    625 bool ViewCellsManager::ExportViewCells(const string filename)  
    626 {  
     640bool ViewCellsManager::ExportViewCells(const string filename) 
     641{ 
    627642        return false; 
    628643} 
     
    18471862void VspBspViewCellsManager::CollectViewCells() 
    18481863{ 
    1849         mVspBspTree->CollectViewCells(mViewCells, false); 
     1864        mVspBspTree->CollectViewCells(mViewCells, mOnlyValidViewCells); 
    18501865} 
    18511866 
     
    18941909 
    18951910        mMaxPvsSize = (int)(mMaxPvsRatio * (float)objects.size()); 
    1896          
     1911 
    18971912        mVspBspTree->Construct(constructionRays, &mViewSpaceBox); 
    18981913 
     
    19962011                if (exporter) 
    19972012                { 
    1998                         if (1) 
     2013                        if (0) 
    19992014                                exporter->SetWireframe(); 
    20002015                        else 
     
    20192034 
    20202035 
    2021 void VspBspViewCellsManager::RefineViewCells(const VssRayContainer &rays) 
     2036void VspBspViewCellsManager::RefineViewCells(const VssRayContainer &rays, 
     2037                                                                                         const ObjectContainer &objects) 
    20222038{ 
    20232039        Debug << "render time before refine:" << endl; 
     
    20312047 
    20322048        // refining the merged view cells 
    2033         const int refined = mVspBspTree->RefineViewCells(rays); 
     2049        const int refined = mVspBspTree->RefineViewCells(rays, objects); 
    20342050 
    20352051        //-- stats and visualizations 
     
    20522068        } 
    20532069 
    2054          
     2070 
    20552071        // view cells already finished before post processing step (i.e. because they were loaded) 
    20562072        if (mViewCellsFinished) 
     
    20602076                return 0; 
    20612077        } 
    2062          
     2078 
    20632079 
    20642080        // check if new view cells turned invalid 
     
    20712087 
    20722088        Debug << "post processing using " << (int)postProcessRays.size() << " samples" << endl; 
    2073          
     2089 
    20742090        Debug << "\nview cell partition after sampling:\n" << mViewCellsStats << endl << endl; 
    20752091 
     
    20842100        MergeViewCells(postProcessRays, objects); 
    20852101        //-- refines the merged view cells 
    2086         RefineViewCells(postProcessRays); 
     2102        RefineViewCells(postProcessRays, objects); 
    20872103        // collapse sibling leaves that share the same view cell 
    20882104        mVspBspTree->CollapseTree(); 
     
    21742190                                exporter->ExportRays(visRays, RgbColor(0, 1, 0)); 
    21752191                        } 
    2176                          
     2192 
    21772193                        ExportViewCellsForViz(exporter); 
    21782194                        delete exporter; 
     
    22112227 
    22122228                                lm = vm; 
    2213                                          
     2229 
    22142230                                vm.mDiffuseColor.r -= 0.45f; 
    22152231                                vm.mDiffuseColor.g -= 0.45f; 
     
    22262242                                        else 
    22272243                                                exporter->SetForcedMaterial(vm); 
    2228                                          
     2244 
    22292245                                        BspNodeGeometry geom; 
    22302246                                        mVspBspTree->ConstructGeometry(leaf, geom); 
     
    22322248                                } 
    22332249                        } 
    2234                          
     2250 
    22352251                        delete exporter; 
    22362252                } 
     
    24102426                                                                                 ViewCell *vc) const 
    24112427{ 
    2412         if (CheckValidity(vc, mMinPvsSize, mMaxPvsSize) && (mColorCode == 0)) // Random color 
     2428        const bool vcValid = CheckValidity(vc, mMinPvsSize, mMaxPvsSize); 
     2429 
     2430        float importance = 0; 
     2431        static Material m; 
     2432 
     2433        switch (mColorCode) 
     2434        { 
     2435        case 0: // Random 
     2436                { 
     2437                        if (vcValid) 
     2438                        { 
     2439                                m = RandomMaterial(); 
     2440                        } 
     2441                        else 
     2442                        { 
     2443                                m.mDiffuseColor.r = 0.0f; 
     2444                                m.mDiffuseColor.g = 1.0f; 
     2445                                m.mDiffuseColor.b = 0.0f; 
     2446                        } 
     2447                } 
    24132448                return; 
    2414  
    2415         float importance = 0; 
    2416         Material m; 
    2417          
    2418         switch (mColorCode) 
    2419         { 
    24202449        case 1: // pvs 
    24212450                { 
     
    24432472        } 
    24442473 
    2445         m.mDiffuseColor.b = CheckValidity(vc, mMinPvsSize, mMaxPvsSize) ? 1.0f : 0.0f; 
     2474        // special color code for invalid view cells 
    24462475        m.mDiffuseColor.r = importance; 
    24472476        m.mDiffuseColor.g = 1.0f - m.mDiffuseColor.r; 
     2477        m.mDiffuseColor.b = vcValid ? 1.0f : 0.0f; 
    24482478 
    24492479        //Debug << "importance: " << importance << endl; 
     
    25152545{ 
    25162546        ViewCellsParser parser; 
    2517          
     2547 
    25182548        DEL_PTR(mVspBspTree); 
    25192549        mVspBspTree = new VspBspTree(); 
    2520          
     2550 
    25212551        bool success = parser.ParseFile(filename, mVspBspTree, this, objects); 
    25222552        mVspBspTree->RepairViewCellsLeafLists(); 
    25232553        mVspBspTree->mBox = GetViewSpaceBox(); 
    25242554        ResetViewCells(); 
    2525          
     2555 
    25262556        mViewCellsFinished = true; 
    25272557        mMaxPvsSize = (int)objects->size(); 
    25282558 
    25292559        FinalizeViewCells(true); 
    2530          
     2560 
    25312561        Debug << (int)mViewCells.size() << " view cells loaded" << endl; 
    25322562 
     
    25432573bool VspBspViewCellsManager::ExportViewCells(const string filename) 
    25442574{ 
    2545         cout << "exporting view cells to xml ... ";  
     2575        cout << "exporting view cells to xml ... "; 
    25462576        std::ofstream stream; 
    25472577 
     
    25522582        stream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"<<endl; 
    25532583        stream << "<Visibility_Solution>" << endl; 
    2554          
     2584 
    25552585        //-- load the view cells itself, i.e., the ids and the pvs 
    25562586        stream << "<ViewCells>" << endl; 
     
    25582588        for (it = mViewCells.begin(); it != it_end; ++ it) 
    25592589                ExportViewCell(*it, stream); 
    2560      
     2590 
    25612591        stream << "</ViewCells>" << endl; 
    2562          
     2592 
    25632593        //-- load the hierarchy 
    25642594        stream << "<BspTree>" << endl; 
    25652595        mVspBspTree->Export(stream); 
    25662596        stream << endl << "</BspTree>" << endl; 
    2567          
     2597 
    25682598        stream << "</Visibility_Solution>" << endl; 
    25692599        stream.close(); 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.h

    r563 r564  
    363363        bool mExportViewCells; 
    364364 
     365        bool mOnlyValidViewCells; 
    365366 
    366367        //-- visualization options 
     
    625626                                                const ObjectContainer &objects); 
    626627         
    627         void RefineViewCells(const VssRayContainer &rays); 
     628        void RefineViewCells(const VssRayContainer &rays, const ObjectContainer &objects); 
    628629 
    629630        void CollectViewCells(); 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.cpp

    r562 r564  
    3030 
    3131int BspMergeCandidate::sMaxPvsSize = 0; 
     32//int BspMergeCandidate::sMinPvsSize = 0; 
    3233 
    3334int VspBspTree::sFrontId = 0; 
     
    6667        environment->GetFloatValue("VspBspTree.Termination.maxCostRatio", mTermMaxCostRatio); 
    6768        environment->GetIntValue("VspBspTree.Termination.missTolerance", mTermMissTolerance); 
     69        environment->GetIntValue("VspBspTree.Termination.maxViewCells", mMaxViewCells); 
     70        //-- max cost ratio for early tree termination 
     71        environment->GetFloatValue("VspBspTree.Termination.maxCostRatio", mTermMaxCostRatio); 
    6872 
    6973        //-- factors for bsp tree split plane heuristics 
     
    7276        environment->GetFloatValue("VspBspTree.Termination.ct_div_ci", mCtDivCi); 
    7377 
    74         //-- max cost ratio for early tree termination 
    75         environment->GetFloatValue("VspBspTree.Termination.maxCostRatio", mTermMaxCostRatio); 
    7678 
    7779        //-- partition criteria 
     
    8385        environment->GetIntValue("VspBspTree.maxTests", mMaxTests); 
    8486 
    85         // maximum and minimum number of view cells 
    86         environment->GetIntValue("VspBspTree.Termination.maxViewCells", mMaxViewCells); 
    87  
     87        // if only the driving axis is used for axis aligned split 
    8888        environment->GetBoolValue("VspBspTree.splitUseOnlyDrivingAxis", mOnlyDrivingAxis); 
    8989 
     
    103103        environment->GetFloatValue("VspBspTree.maxStaticMemory", mMaxMemory); 
    104104 
    105          
     105        environment->GetBoolValue("VspBspTree.Visualization.exportMergedViewCells", mExportMergedViewCells); 
     106        environment->GetBoolValue("VspBspTree.PostProcess.exportMergeStats", mExportMergeStats); 
     107         
     108 
    106109        mStats.open("bspStats.log"); 
    107110 
     
    123126        Debug << "using area for pvs: " << mUseAreaForPvs << endl; 
    124127        Debug << "Split plane strategy: "; 
     128 
    125129        if (mSplitPlaneStrategy & RANDOM_POLYGON) 
    126130        { 
     
    329333                float minT, maxT; 
    330334 
    331                 //static Ray hray; 
    332                 //hray.Init(ray.GetOrigin(), ray.GetDir(), Ray::LINE_SEGMENT); 
     335                static Ray hray; 
     336                hray.Init(*ray); 
    333337 
    334338                // TODO: not very efficient to implictly cast between rays types 
    335                 if (mBox.GetRaySegment(*ray, minT, maxT)) 
     339                if (mBox.GetRaySegment(hray, minT, maxT)) 
    336340                { 
    337341                        float len = ray->Length(); 
     
    515519                                leaf->mVssRays.push_back((*it).mRay); 
    516520                } 
    517                  
     521                // should I check here? 
    518522                if (0 && !mViewCellsManager->CheckValidity(viewCell, 0, mViewCellsManager->GetMaxPvsSize())) 
    519523                { 
     
    17261730                if (node->IsLeaf()) 
    17271731                { 
    1728                         if (!onlyValid ||node->TreeValid()) 
     1732                        if (!onlyValid || node->TreeValid()) 
    17291733                        { 
    17301734                                ViewCell *viewCell = dynamic_cast<BspLeaf *>(node)->GetViewCell(); 
     
    25722576 
    25732577        // clean up old view cells 
    2574         if (0) 
     2578        if (mExportMergedViewCells) 
    25752579        { 
    25762580                DEL_PTR(fVc); 
     
    26312635                        if ((*nit)->GetViewCell() != leaf->GetViewCell()) 
    26322636                        { 
    2633                                 mMergeQueue.push(BspMergeCandidate(leaf, *nit)); 
     2637                                BspMergeCandidate mc(leaf, *nit); 
     2638                                mc.EvalMergeCost(); 
     2639 
     2640                                mMergeQueue.push(mc); 
    26342641                                ++ candidates; 
    26352642                        } 
     
    26372644        } 
    26382645 
    2639         Debug << "found " << candidates << " new merge candidates" << endl; 
     2646        Debug << "mergequeue: " << (int)mMergeQueue.size() << endl; 
     2647        Debug << "leaves in queue: " << candidates << endl; 
     2648        Debug << "overall cost: " << BspMergeCandidate::sOverallCost << endl; 
     2649 
    26402650 
    26412651        return (int)leaves.size(); 
     
    27262736                        if (!found) 
    27272737                        { 
    2728                                 // this pair is not in map already 
     2738                                // this pair is not in map yet 
    27292739                                // => insert into the neighbor map and the queue 
    27302740                                neighbors.push_back(prevLeaf); 
     
    27342744                                prevLeaf->Mail(); 
    27352745                 
    2736                                 mMergeQueue.push(BspMergeCandidate(leaf, prevLeaf)); 
     2746                                BspMergeCandidate mc(leaf, prevLeaf); 
     2747                                mc.EvalMergeCost(); 
     2748 
     2749                                mMergeQueue.push(mc); 
     2750 
     2751                                if (((int)mMergeQueue.size() % 1000) == 0) 
     2752                                { 
     2753                                        cout << "collected " << (int)mMergeQueue.size() << " merge candidates" << endl; 
     2754                                } 
    27372755                        } 
    27382756        } 
    27392757        } 
     2758 
    27402759        Debug << "neighbormap size: " << (int)neighborMap.size() << endl; 
    27412760        Debug << "mergequeue: " << (int)mMergeQueue.size() << endl; 
     
    28042823{ 
    28052824        BspMergeCandidate::sMaxPvsSize = mViewCellsManager->GetMaxPvsSize(); 
     2825        //BspMergeCandidate::sMinPvsSize = mViewCellsManager->GetMinPvsSize(); 
    28062826        BspMergeCandidate::sUseArea = mUseAreaForPvs; 
    28072827 
    28082828        // the current view cells are kept in this container 
    28092829        ViewCellContainer viewCells; 
    2810         ViewCell::NewMail(); 
    2811         CollectViewCells(mRoot, true, viewCells, true); 
     2830        if (mExportMergedViewCells) 
     2831        { 
     2832                ViewCell::NewMail(); 
     2833                CollectViewCells(mRoot, true, viewCells, true); 
     2834        } 
    28122835        ViewCell::NewMail(); 
    28132836 
    28142837        MergeStatistics mergeStats; 
    28152838        mergeStats.Start(); 
    2816         // TODO: REMOVE LATER for performance! 
    2817         const bool showMergeStats = false; 
    2818  
     2839         
    28192840        //BspMergeCandidate::sOverallCost = mBox.SurfaceArea() * mStat.maxPvs; 
    28202841        long startTime = GetTime(); 
    28212842 
     2843        cout << "collecting merge candidates ... "; 
     2844         
    28222845        if (mUseRaysForMerge) 
    28232846        { 
    2824                 cout << "collecting merge candidates (rays) ... "; 
    28252847                mergeStats.nodes = CollectMergeCandidates(rays); 
    2826                 cout << "fininshed collecting candidates" << endl; 
    28272848        } 
    28282849        else 
     
    28322853                mergeStats.nodes = CollectMergeCandidates(leaves); 
    28332854        } 
    2834                  
     2855         
     2856        cout << "fininshed collecting candidates" << endl; 
    28352857 
    28362858        mergeStats.collectTime = TimeDiff(startTime, GetTime()); 
     
    28402862        // number of view cells withouth the invalid ones 
    28412863        int nViewCells = mStat.Leaves() - mStat.invalidLeaves; 
    2842         Debug << "number of view cells taken into account: " << nViewCells << endl; 
     2864         
     2865         
    28432866        // pass is needed for statistics. the last n passes are 
    28442867        // recorded 
    28452868        const int maxPasses = 1000; 
     2869        const int nextPass = 50; 
     2870 
    28462871        int pass = max(nViewCells - mMergeMinViewCells - maxPasses, 0); 
    2847         const int nextPass = 50; 
    2848  
    2849         cout << "starting merge ... " << endl; 
     2872         
     2873        cout << "actual merge starts now ... " << endl; 
    28502874 
    28512875        //-- use priority queue to merge leaf pairs 
     
    28812905                        ++ mergeStats.merged; 
    28822906 
    2883                         if (showMergeStats) 
     2907                        if ((mergeStats.merged % 500) == 0) 
     2908                                cout << "merged " << mergeStats.merged << " view cells" << endl; 
     2909 
     2910                        // stats and visualizations 
     2911                        if (mExportMergeStats) 
    28842912                        { 
    28852913                                if (mc.GetLeaf1()->IsSibling(mc.GetLeaf2())) 
     
    28922920                                mergeStats.accTreeDist += dist; 
    28932921 
    2894                                 //Debug << "viewcells: " << nViewCells << " mergemin " << mMergeMinViewCells << endl; 
    28952922                                if ((mergeStats.merged == pass) || (nViewCells == mMergeMinViewCells)) 
    28962923                                { 
     
    29032930                                                << "#CurrentCost\n" << mergeCost << endl 
    29042931                                                << "#RelativeCost\n" << mergeCost / BspMergeCandidate::sOverallCost << endl 
    2905                                                 << "#CurrentPvs\n" << mc.GetLeaf1()->GetViewCell()->GetPvs().GetSize() << endl; 
    2906                                          
    2907                                         ViewCellContainer::const_iterator vit, vit_end = viewCells.end(); 
    2908                                          
    2909                                         // find all already merged view cells and remove them from view cells 
    2910                                         int i = 0; 
    2911                                         while (1) 
    2912                                         { 
    2913                                                 //while (!viewCells.empty() && (viewCells.back()->mMailbox == -1)) 
    2914                                                 while (!viewCells.empty() && (viewCells.back()->GetId() == -2)) 
    2915                                                 { 
    2916                                                         //DEL_PTR(viewCells.back()); 
    2917                                                         viewCells.pop_back(); 
    2918                                                 } 
    2919                                                 // all merged view cells have been found 
    2920                                                 if (i >= viewCells.size())  
    2921                                                         break; 
    2922  
    2923                                                 // already merged view cell, put it to end of vector 
    2924                                                 //if (viewCells[i]->mMailbox == -1) 
    2925                                                 if (viewCells[i]->GetId() == -2) 
    2926                                                         swap(viewCells[i], viewCells.back()); 
    2927                                                  
    2928                                                 ++ i; 
    2929                                         } 
    2930                                  
    2931                                         int newVcSize = 0; 
    2932                                         // add new view cells to container only if they don't have been  
    2933                                         // merged in the mean time 
    2934                                         while (!mNewViewCells.empty()) 
    2935                                         { 
    2936                                                 if (mNewViewCells.back()->GetId() != -2) 
    2937                                                 { 
    2938                                                         viewCells.push_back(mNewViewCells.back()); 
    2939                                                         ++ newVcSize; 
    2940                                                 } 
    2941  
    2942                                                 mNewViewCells.pop_back(); 
    2943                                         } 
    2944  
    2945                                         // delete the view cells which were merged 
    2946                                         CLEAR_CONTAINER(mOldViewCells); 
    2947  
    2948                                         char s[64]; 
    2949                                         sprintf(s, "merged_viewcells%07d.x3d", nViewCells); 
    2950                                         Exporter *exporter = Exporter::GetExporter(s); 
    2951                                  
    2952                                         if (exporter) 
    2953                                         { 
    2954                                                 cout << "exporting " << nViewCells << " merged view cells ... "; 
    2955                                                 exporter->ExportGeometry(objects); 
    2956                                                 //Debug << "vc size " << (int)viewCells.size() << " merge queue size: " << (int)mMergeQueue.size() << endl; 
    2957                                                 ViewCellContainer::const_iterator it, it_end = viewCells.end(); 
    2958                  
    2959                                                 int i = 0; 
    2960                                                 for (it = viewCells.begin(); it != it_end; ++ it) 
    2961                                                 { 
    2962                                                         Material m; 
    2963                                                         // assign special material to new view cells 
    2964                                                         // new view cells are on the back of container 
    2965                                                         if (i ++ >= (viewCells.size() - newVcSize)) 
    2966                                                         { 
    2967                                                                 //m = RandomMaterial(); 
    2968                                                                 m.mDiffuseColor.r = RandomValue(0.5f, 1.0f); 
    2969                                                                 m.mDiffuseColor.g = RandomValue(0.5f, 1.0f); 
    2970                                                                 m.mDiffuseColor.b = RandomValue(0.5f, 1.0f); 
    2971                                                         } 
    2972                                                         else 
    2973                                                         { 
    2974                                                                 float col = RandomValue(0.1f, 0.4f); 
    2975                                                                 m.mDiffuseColor.r = col; 
    2976                                                                 m.mDiffuseColor.g = col; 
    2977                                                                 m.mDiffuseColor.b = col; 
    2978                                                         } 
    2979  
    2980                                                         exporter->SetForcedMaterial(m); 
    2981                                                         mViewCellsManager->ExportVcGeometry(exporter, *it); 
    2982                                                 } 
    2983                                                 delete exporter; 
    2984                                                 cout << "finished" << endl; 
    2985                                         } 
    2986                                          
     2932                                                << "#CurrentPvs\n" << mc.GetLeaf1()->GetViewCell()->GetPvs().GetSize() << endl 
     2933                                                << "#MergedSiblings\n" << mergeStats.siblings << endl 
     2934                                                << "#AvgTreeDist\n" << mergeStats.AvgTreeDist() << endl; 
     2935 
     2936                                                if (mExportMergedViewCells) 
     2937                                                        ExportMergedViewCells(viewCells, objects, nViewCells);    
    29872938                                } 
    29882939                        } 
    2989                         mNewViewCells.clear(); 
    29902940                } 
    29912941                // merge candidate not valid, because one of the leaves was already 
     
    29982948        } 
    29992949 
    3000         // view cells which were merged and are not part of any leaf 
    3001         CLEAR_CONTAINER(mOldViewCells); 
    3002          
    3003         cout << "finished merge" << endl; 
     2950        mergeStats.overallCost = BspMergeCandidate::sOverallCost; 
     2951 
    30042952        mergeStats.mergeTime = TimeDiff(startTime, GetTime()); 
    30052953        mergeStats.Stop(); 
    30062954 
    3007         if (showMergeStats) 
    3008                 Debug << mergeStats << endl << endl; 
     2955        Debug << mergeStats << endl << endl; 
     2956         
     2957        // delete the view cells which were already merged 
     2958        CLEAR_CONTAINER(mOldViewCells); 
    30092959         
    30102960 
     
    30472997 
    30482998 
    3049 int VspBspTree::RefineViewCells(const VssRayContainer &rays) 
     2999void VspBspTree::ExportMergedViewCells(ViewCellContainer &viewCells,  
     3000                                                                           const ObjectContainer &objects, 
     3001                                                                           const int nViewCells) 
     3002{ 
     3003        ViewCellContainer::const_iterator vit, vit_end = viewCells.end(); 
     3004                                         
     3005        // find all already merged view cells and remove them from view cells 
     3006        int i = 0; 
     3007 
     3008        while (1) 
     3009        { 
     3010                //while (!viewCells.empty() && (viewCells.back()->mMailbox == -1)) 
     3011                while (!viewCells.empty() && (viewCells.back()->GetId() == -2)) 
     3012                { 
     3013                        //DEL_PTR(viewCells.back()); 
     3014                        viewCells.pop_back(); 
     3015                } 
     3016                // all merged view cells have been found 
     3017                if (i >= viewCells.size())  
     3018                        break; 
     3019 
     3020                // already merged view cell, put it to end of vector 
     3021                //if (viewCells[i]->mMailbox == -1) 
     3022                if (viewCells[i]->GetId() == -2) 
     3023                        swap(viewCells[i], viewCells.back()); 
     3024                 
     3025                ++ i; 
     3026        } 
     3027 
     3028        int newVcSize = 0; 
     3029        // add new view cells to container only if they don't have been  
     3030        // merged in the mean time 
     3031        while (!mNewViewCells.empty()) 
     3032        { 
     3033                if (mNewViewCells.back()->GetId() != -2) 
     3034                { 
     3035                        viewCells.push_back(mNewViewCells.back()); 
     3036                        ++ newVcSize; 
     3037                } 
     3038 
     3039                mNewViewCells.pop_back(); 
     3040        } 
     3041 
     3042        char s[64]; 
     3043        sprintf(s, "merged_viewcells%07d.x3d", nViewCells); 
     3044        Exporter *exporter = Exporter::GetExporter(s); 
     3045 
     3046        if (exporter) 
     3047        { 
     3048                cout << "exporting " << nViewCells << " merged view cells ... "; 
     3049                exporter->ExportGeometry(objects); 
     3050                //Debug << "vc size " << (int)viewCells.size() << " merge queue size: " << (int)mMergeQueue.size() << endl; 
     3051                ViewCellContainer::const_iterator it, it_end = viewCells.end(); 
     3052 
     3053                int i = 0; 
     3054                for (it = viewCells.begin(); it != it_end; ++ it) 
     3055                { 
     3056                        Material m; 
     3057                        // assign special material to new view cells 
     3058                        // new view cells are on the back of container 
     3059                        if (i ++ >= (viewCells.size() - newVcSize)) 
     3060                        { 
     3061                                //m = RandomMaterial(); 
     3062                                m.mDiffuseColor.r = RandomValue(0.5f, 1.0f); 
     3063                                m.mDiffuseColor.g = RandomValue(0.5f, 1.0f); 
     3064                                m.mDiffuseColor.b = RandomValue(0.5f, 1.0f); 
     3065                        } 
     3066                        else 
     3067                        { 
     3068                                float col = RandomValue(0.1f, 0.4f); 
     3069                                m.mDiffuseColor.r = col; 
     3070                                m.mDiffuseColor.g = col; 
     3071                                m.mDiffuseColor.b = col; 
     3072                        } 
     3073 
     3074                        exporter->SetForcedMaterial(m); 
     3075                        mViewCellsManager->ExportVcGeometry(exporter, *it); 
     3076                } 
     3077                delete exporter; 
     3078                cout << "finished" << endl; 
     3079        } 
     3080 
     3081        // delete the view cells which were merged 
     3082        CLEAR_CONTAINER(mOldViewCells); 
     3083        // remove the new view cells 
     3084        mNewViewCells.clear(); 
     3085} 
     3086 
     3087 
     3088int VspBspTree::RefineViewCells(const VssRayContainer &rays, const ObjectContainer &objects) 
    30503089{ 
    30513090        int shuffled = 0; 
     
    30553094 
    30563095        // Use priority queue of remaining leaf pairs  
    3057         // These candidates either share the same view cells or 
     3096        // The candidates either share the same view cells or 
    30583097        // are border leaves which share a boundary. 
    30593098        // We test if they can be shuffled, i.e., 
     
    30613100        // leaf is made part of the other view cell. It is tested if the 
    30623101        // remaining view cells are "better" than the old ones. 
     3102        // 
     3103        // repeat the merging test numPasses times. For example, it could be 
     3104        // that a shuffle only makes sense if another pair was shuffled before. 
     3105        // Therefore we keep two queues and shift the merge candidates between 
     3106        // those two queues until numPasses is reached 
     3107         
     3108        queue<BspMergeCandidate> queue1; 
     3109        queue<BspMergeCandidate> queue2; 
     3110 
     3111        queue<BspMergeCandidate> *shuffleQueue = &queue1; 
     3112        queue<BspMergeCandidate> *backQueue = &queue2; 
     3113 
     3114    Exporter *exporter = Exporter::GetExporter("neighors.x3d"); 
     3115 
     3116        if (exporter) 
     3117        { 
     3118                cout << "exporting neighbors ... "; 
     3119                exporter->ExportGeometry(objects); 
     3120        } 
     3121 
     3122        // HACK for visualization 
     3123        ViewCellContainer viewCells; 
     3124        ViewCell::NewMail(); 
     3125        CollectViewCells(mRoot, true, viewCells, true); 
     3126        for (int i = 0; i < viewCells.size(); ++i) 
     3127                viewCells[i]->SetId((int)RandomValue(0, Real(256*256*256))); 
     3128         
     3129        Material m; 
     3130        m.mDiffuseColor.r = 0; 
     3131        m.mDiffuseColor.g = 0; 
     3132        m.mDiffuseColor.b = 0; 
     3133 
    30633134        while (!mMergeQueue.empty()) 
    30643135        { 
    30653136                BspMergeCandidate mc = mMergeQueue.top(); 
     3137                shuffleQueue->push(mc); 
    30663138                mMergeQueue.pop(); 
    30673139 
    3068                 // both view cells equal or already shuffled 
    3069                 if ((mc.GetLeaf1()->GetViewCell() == mc.GetLeaf2()->GetViewCell()) || 
    3070                         (mc.GetLeaf1()->Mailed()) || (mc.GetLeaf2()->Mailed())) 
    3071                         continue; 
     3140                m = RandomMaterial(); 
     3141                // visualize neighbors 
     3142                exporter->SetForcedMaterial(m); 
    30723143                 
    3073                 // candidate for shuffling 
    3074                 const bool wasShuffled =  
    3075                         ShuffleLeaves(mc.GetLeaf1(), mc.GetLeaf2()); 
     3144                BspNodeGeometry geom1, geom2; 
     3145 
     3146                ConstructGeometry(mc.GetLeaf1(), geom1); 
     3147                ConstructGeometry(mc.GetLeaf1(), geom2); 
     3148 
     3149                //m.mDiffuseColor.r = (mc.GetLeaf1()->GetViewCell()->GetId() & 256)/ 255.0f; 
     3150                //m.mDiffuseColor.g = ((mc.GetLeaf1()->GetViewCell()->GetId()>>8) & 256)/ 255.0f; 
     3151                //m.mDiffuseColor.b = ((mc.GetLeaf1()->GetViewCell()->GetId()>>16) & 256)/ 255.0f; 
     3152                exporter->SetForcedMaterial(m); 
     3153 
     3154                exporter->ExportPolygons(geom1.mPolys); 
    30763155                 
    3077                 //-- stats 
    3078                 if (wasShuffled) 
    3079                         ++ shuffled; 
     3156                //m.mDiffuseColor.r = (mc.GetLeaf2()->GetViewCell()->GetId() & 256)/ 255.0f; 
     3157                //m.mDiffuseColor.g = ((mc.GetLeaf2()->GetViewCell()->GetId()>>8) & 256)/ 255.0f; 
     3158                //m.mDiffuseColor.b = ((mc.GetLeaf2()->GetViewCell()->GetId()>>16) & 256)/ 255.0f; 
     3159                //exporter->SetForcedMaterial(m); 
     3160 
     3161                exporter->ExportPolygons(geom2.mPolys); 
     3162        } 
     3163 
     3164        if (exporter) 
     3165        { 
     3166                cout << "finished" << endl; 
     3167                delete exporter; 
     3168        } 
     3169 
     3170        const int numPasses = 5; 
     3171        int pass = 0; 
     3172        int passShuffled = 0; 
     3173 
     3174 
     3175        do 
     3176        { 
     3177                passShuffled = 0; 
     3178                while (!shuffleQueue->empty()) 
     3179                { 
     3180                        BspMergeCandidate mc = shuffleQueue->front(); 
     3181                        shuffleQueue->pop(); 
     3182 
     3183                        // both view cells equal or already shuffled 
     3184                        if ((mc.GetLeaf1()->GetViewCell() == mc.GetLeaf2()->GetViewCell()))// || 
     3185                        //      (mc.GetLeaf1()->Mailed()) || (mc.GetLeaf2()->Mailed())) 
     3186                                continue; 
     3187                 
     3188                        // candidate for shuffling 
     3189                        const bool wasShuffled =  
     3190                                ShuffleLeaves(mc.GetLeaf1(), mc.GetLeaf2()); 
     3191                 
     3192                        if (wasShuffled) 
     3193                                ++ passShuffled; 
     3194                        else 
     3195                                backQueue->push(mc); 
     3196                } 
     3197 
     3198                // now the back queue is the current shuffle queue 
     3199                swap(shuffleQueue, backQueue); 
     3200                shuffled += passShuffled; 
     3201                Debug << "shuffled in pass: " << passShuffled << endl; 
     3202        } 
     3203        while (((++ pass) < numPasses) && passShuffled); 
     3204 
     3205        while (!shuffleQueue->empty()) 
     3206        { 
     3207                shuffleQueue->pop(); 
    30803208        } 
    30813209 
     
    33123440mLeaf2Id(l2->GetViewCell()->mMailbox) 
    33133441{ 
    3314         EvalMergeCost(); 
     3442        //EvalMergeCost(); 
    33153443} 
    33163444 
     
    33363464        BspViewCell *vc = mLeaf2->GetViewCell(); 
    33373465        return GetCost(vc); 
     3466} 
     3467 
     3468 
     3469int ComputeMergedPvsSize(const ObjectPvs &pvs1, const ObjectPvs &pvs2) 
     3470{ 
     3471        int pvs = pvs1.GetSize(); 
     3472 
     3473        // compute new pvs size 
     3474        ObjectPvsMap::const_iterator it, it_end =  pvs1.mEntries.end(); 
     3475 
     3476        Intersectable::NewMail(); 
     3477 
     3478        for (it = pvs1.mEntries.begin(); it != it_end; ++ it) 
     3479        { 
     3480                (*it).first->Mail(); 
     3481        } 
     3482 
     3483        it_end = pvs2.mEntries.end(); 
     3484 
     3485        for (it = pvs2.mEntries.begin(); it != it_end; ++ it) 
     3486        { 
     3487                Intersectable *obj = (*it).first; 
     3488                if (!obj->Mailed()) 
     3489                        ++ pvs; 
     3490        } 
     3491 
     3492        return pvs; 
    33383493} 
    33393494 
     
    33453500        BspViewCell *vc2 = mLeaf2->GetViewCell(); 
    33463501 
    3347         const int diff1 = vc1->GetPvs().Diff(vc2->GetPvs()); 
    3348         const int newPvs = diff1 + vc1->GetPvs().GetSize(); 
     3502        //const int diff1 = vc1->GetPvs().Diff(vc2->GetPvs()); 
     3503        //const int newPvs = diff1 + vc1->GetPvs().GetSize(); 
     3504        const int newPvs = ComputeMergedPvsSize(vc1->GetPvs(), vc2->GetPvs()); 
    33493505 
    33503506        //-- compute ratio of old cost 
     
    33603516        if (newPvs > sMaxPvsSize) // strong penalty if pvs size too large 
    33613517        { 
    3362                 mMergeCost = 1e15f; 
     3518                mMergeCost = 1e15; 
    33633519        } 
    33643520        else 
     
    34173573 
    34183574/************************************************************************/ 
    3419 /*                  MergeStatistics implementation                      */ 
     3575/*                    MergeStatistics implementation                    */ 
    34203576/************************************************************************/ 
    34213577 
     
    34383594 
    34393595        app << "#N_MERGEDSIBLINGS ( Number of merged siblings )\n" << siblings << "\n"; 
     3596 
     3597        app << "#OVERALLCOST ( overall merge cost )\n" << overallCost << "\n"; 
     3598 
    34403599        app << "#N_MERGEDNODES ( Number of merged nodes )\n" << merged << "\n"; 
    34413600 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VspBspTree.h

    r562 r564  
    261261                @returns number of refined view cells 
    262262        */ 
    263         int RefineViewCells(const VssRayContainer &rays); 
     263        int RefineViewCells(const VssRayContainer &rays, const ObjectContainer &objects); 
    264264 
    265265        /** Collapses the tree with respect to the view cell partition. 
     
    615615        float GetMemUsage() const; 
    616616 
     617        /** Calculates cost for merge of view cell 1 and 2. 
     618        */ 
    617619        float GetShuffledVcCost(BspLeaf *leaf, BspViewCell *vc1, BspViewCell *vc2) const; 
     620 
     621        void ExportMergedViewCells(ViewCellContainer &viewCells,  
     622                                                           const ObjectContainer &objects, 
     623                                                           const int nViewCells); 
    618624 
    619625        /// Pointer to the root of the tree 
     
    722728        /// the tree is out of memory 
    723729        bool mOutOfMemory; 
     730        /// if merge visualization should be shown 
     731        bool mExportMergedViewCells; 
     732        /// if merge statistics should be exported 
     733        bool mExportMergeStats; 
    724734 
    725735private: 
     
    784794        /// maximal pvs size 
    785795        static int sMaxPvsSize; 
     796        /// minimal pvs size 
     797        //static int sMinPvsSize; 
     798 
    786799        /// overall cost used to normalize cost ratio 
    787800        static float sOverallCost; 
     
    823836        Real collectTime; 
    824837        Real mergeTime; 
     838 
     839        Real overallCost; 
    825840 
    826841        // Constructor 
     
    844859                collectTime = 0; 
    845860                mergeTime = 0; 
     861                overallCost = 0; 
    846862        } 
    847863 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.cpp

    r557 r564  
    105105  if (!mDetectEmptyViewSpace) 
    106106        ray.mFlags &= ~Ray::CULL_BACKFACES; 
    107                                                            else 
    108                                                                 ray.mFlags |= Ray::CULL_BACKFACES; 
     107  else 
     108        ray.mFlags |= Ray::CULL_BACKFACES; 
    109109 
    110110  if (mKdTree->CastRay(ray)) { 
     
    601601           
    602602  } 
    603    
     603  
     604 
    604605  cout << "#totalRayStackSize=" << (int)mVssRays.size() << endl << flush; 
    605606  Debug << (int)mVssRays.size() << " rays generated in "  
  • trunk/VUT/GtpVisibilityPreprocessor/src/X3dExporter.cpp

    r547 r564  
    12541254 
    12551255        // box should not never remove part of beam polygons 
    1256         Vector3 bmin = beam.mBox.Min() - Vector3(zfar * 2.0); 
    1257         Vector3 bmax = beam.mBox.Max() + Vector3(zfar * 2.0); 
     1256        Vector3 bmin = beam.mBox.Min() - Vector3(zfar * 2.0f); 
     1257        Vector3 bmax = beam.mBox.Max() + Vector3(zfar * 2.0f); 
    12581258 
    12591259        AxisAlignedBox3 bbox(bmin, bmax); 
Note: See TracChangeset for help on using the changeset viewer.