Ignore:
Timestamp:
11/07/06 09:12:49 (18 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
3 edited

Legend:

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

    r1715 r1717  
    293293        Environment::GetSingleton()->GetIntValue("BvHierarchy.minRaysForVisibility", mMinRaysForVisibility); 
    294294         
     295        //mUseBboxAreaForSah = false; 
    295296        mUseBboxAreaForSah = true; 
    296  
    297297 
    298298        ///////////// 
     
    862862 
    863863                SortableEntryContainer::reverse_iterator rcit =  
    864                         mSubdivisionCandidates->rbegin(), rcit_end = mSubdivisionCandidates->rend(); 
     864                        mSubdivisionCandidates->rbegin(), rcit_end =  
     865                        mSubdivisionCandidates->rend(); 
    865866         
    866867                vector<float>::reverse_iterator rbit = bordersRight.rbegin(); 
     
    892893 
    893894                const float renderCost = mViewCellsManager->EvalRenderCost(obj); 
    894                 //const int renderCost = 1; 
    895  
     895                 
    896896                objectsLeft += renderCost; 
    897897                objectsRight -= renderCost; 
     
    921921                { 
    922922                        // just add up areas of the objects itself 
    923                         // (as we are not sampling volumetric visibility, 
     923                        // As we are not sampling volumetric visibility, 
    924924                        // this should provide better heuristics 
    925925                        const float area = obj->GetArea();//obox.SurfaceArea(); 
     
    936936                         << lbox.SurfaceArea() << "," << rbox.SurfaceArea() << ")" << endl; 
    937937                cout << "minborder: " << minBorder << " maxborder: " << maxBorder << endl; 
    938             cout << "cost= " << sum << endl; 
    939 */ 
     938            cout << "cost= " << sum << endl;*/ 
    940939         
    941940                if (sum < minSum)  
    942                 {       //cout <<" sum: " << sum; 
     941                {        
    943942                        minSum = sum; 
    944943                        areaLeft = al; 
     
    950949        } 
    951950 
    952         //////////////////////////////////////////// 
     951        //////////// 
    953952        //-- assign object to front and back volume 
    954953 
     
    964963        float ratio = newCost / totalRenderCost; 
    965964   
    966 #ifdef _DEBUG 
     965#ifdef GTP_DEBUG 
    967966        cout << "\n\nobjects=(" << (int)objectsBack.size() << "," << (int)objectsFront.size() << " of "  
    968967                 << (int)tData.mNode->mObjects.size() << ")\t area=("  
     
    973972        return ratio; 
    974973} 
     974 
    975975#else 
    976976 
     
    10061006        vector<Vector3> bordersRight; 
    10071007 
    1008         if (mUseBboxAreaForSah) 
    1009         { 
    1010                 // we keep track of both borders of the bounding boxes => 
    1011                 // store the events in descending order 
    1012                 bordersRight.resize(mSubdivisionCandidates->size()); 
    1013  
    1014                 SortableEntryContainer::reverse_iterator rcit =  
    1015                         mSubdivisionCandidates->rbegin(), rcit_end = mSubdivisionCandidates->rend(); 
    1016          
    1017                 vector<Vector3>::reverse_iterator rbit = bordersRight.rbegin(); 
    1018          
    1019                 for (; rcit != rcit_end; ++ rcit, ++ rbit)  
    1020                 { 
    1021                         Intersectable *obj = (*rcit).mObject; 
    1022                         const AxisAlignedBox3 obox = obj->GetBox(); 
    1023  
    1024                         for (int i = 0; i < 3; ++ i) 
     1008        // we keep track of both borders of the bounding boxes => 
     1009        // store the events in descending order 
     1010        bordersRight.resize(mSubdivisionCandidates->size()); 
     1011 
     1012        SortableEntryContainer::reverse_iterator rcit =  
     1013                mSubdivisionCandidates->rbegin(), rcit_end =  
     1014                mSubdivisionCandidates->rend(); 
     1015 
     1016        vector<Vector3>::reverse_iterator rbit = bordersRight.rbegin(); 
     1017 
     1018        for (; rcit != rcit_end; ++ rcit, ++ rbit)  
     1019        { 
     1020                Intersectable *obj = (*rcit).mObject; 
     1021                const AxisAlignedBox3 obox = obj->GetBox(); 
     1022 
     1023                for (int i = 0; i < 3; ++ i) 
     1024                { 
     1025                        if (obox.Min(i) < minBorder[i]) 
    10251026                        { 
    1026                                 if (obox.Min(i) < minBorder[i]) 
    1027                                 { 
    1028                                         minBorder[i] = obox.Min(i); 
    1029                                 } 
     1027                                minBorder[i] = obox.Min(i); 
    10301028                        } 
    1031  
    1032                         (*rbit) = minBorder; 
    1033                 } 
     1029                } 
     1030 
     1031                (*rbit) = minBorder; 
    10341032        } 
    10351033 
     
    10391037 
    10401038        vector<Vector3>::const_iterator bit = bordersRight.begin(); 
    1041         SortableEntryContainer::const_iterator cit, cit_end = mSubdivisionCandidates->end(); 
     1039        SortableEntryContainer::const_iterator cit, cit_end = 
     1040                mSubdivisionCandidates->end(); 
    10421041 
    10431042        for (cit = mSubdivisionCandidates->begin(); cit != cit_end; ++ cit, ++ bit)  
     
    10521051                const AxisAlignedBox3 obox = obj->GetBox(); 
    10531052 
    1054                 if (mUseBboxAreaForSah) 
    1055                 { 
    1056                         AxisAlignedBox3 lbox = nodeBbox; 
    1057                         AxisAlignedBox3 rbox = nodeBbox; 
    1058          
    1059                         // the borders of the bounding boxes have changed 
    1060                         for (int i = 0; i < 3; ++ i) 
     1053                AxisAlignedBox3 lbox = nodeBbox; 
     1054                AxisAlignedBox3 rbox = nodeBbox; 
     1055         
     1056                // the borders of the bounding boxes have changed 
     1057                for (int i = 0; i < 3; ++ i) 
     1058                { 
     1059                        if (obox.Max(i) > maxBorder[i]) 
    10611060                        { 
    1062                                 if (obox.Max(i) > maxBorder[i]) 
    1063                                 { 
    1064                                         maxBorder[i] = obox.Max(i); 
    1065                                 } 
     1061                                maxBorder[i] = obox.Max(i); 
    10661062                        } 
    1067  
    1068                         minBorder = (*bit); 
    1069  
    1070                         lbox.SetMax(maxBorder); 
    1071                         rbox.SetMin(minBorder); 
    1072          
    1073                         al = lbox.SurfaceArea(); 
    1074                         ar = rbox.SurfaceArea(); 
    1075                 } 
    1076                 else 
    1077                 { 
    1078                         // just add up areas of the objects itself 
    1079                         // (as we are not sampling volumetric visibility, 
    1080                         // this should provide better heuristics 
    1081                         const float area = obj->GetArea();//obox.SurfaceArea(); 
    1082  
    1083                         al += area; 
    1084                         ar -= area; 
    1085                 } 
    1086  
     1063                } 
     1064 
     1065                minBorder = (*bit); 
     1066 
     1067                lbox.SetMax(maxBorder); 
     1068                rbox.SetMin(minBorder); 
     1069 
     1070                al = lbox.SurfaceArea(); 
     1071                ar = rbox.SurfaceArea(); 
     1072         
    10871073                const bool noValidSplit = ((objectsLeft <= Limits::Small) || (objectsRight <= Limits::Small)); 
    10881074                const float sum =  noValidSplit ? 1e25 : objectsLeft * al + objectsRight * ar; 
     
    10911077                         << lbox.SurfaceArea() << "," << rbox.SurfaceArea() << ")" << endl; 
    10921078                cout << "minborder: " << minBorder << " maxborder: " << maxBorder << endl; 
    1093             cout << "cost= " << sum << endl; 
    1094 */ 
     1079            cout << "cost= " << sum << endl;*/ 
    10951080         
    10961081                if (sum < minSum)  
    1097                 {       //cout <<" sum: " << sum; 
     1082                {        
    10981083                        minSum = sum; 
    10991084                        areaLeft = al; 
     
    11051090        } 
    11061091 
    1107         //////////////////////////////////////////// 
     1092        ///////////// 
    11081093        //-- assign object to front and back volume 
    11091094 
     
    11201105   
    11211106#ifdef GTP_DEBUG 
    1122 //      if (objectsBack.empty() ||objectsFront.empty()) 
    11231107        cout << "\n\nobjects=(" << (int)objectsBack.size() << "," << (int)objectsFront.size() << " of "  
    11241108                 << (int)tData.mNode->mObjects.size() << ")\t area=("  
     
    11531137 
    11541138 
    1155 static void PrintHeuristics(const int objectsRight, 
     1139static void PrintHeuristics(const float objectsRight, 
    11561140                                                        const float sum, 
    11571141                                                        const float volLeft, 
     
    11831167{ 
    11841168        /////////////////////////////////////////////////////// 
    1185         // -- go through the lists, count the number of objects left  
     1169        //-- go through the lists, count the number of objects left  
    11861170        //-- and right and evaluate the cost funcion 
    11871171 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r1716 r1717  
    58265826        Debug << "view cell evaluation samples: " << numSamples << endl; 
    58275827        Debug << "view cell stats prefix: " << statsPrefix << endl; 
     5828        Debug << "step size: " << splitsStepSize << endl; 
    58285829 
    58295830        cout << "reseting pvs ... "; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/common.h

    r1715 r1717  
    485485FileExists(char *filename); 
    486486 
    487 #define GTP_DEBUG 0 
     487//#define GTP_DEBUG 1 
    488488 
    489489#define DEBUG_LEVEL 5 
Note: See TracChangeset for help on using the changeset viewer.