Changeset 1717 for GTP/trunk/Lib/Vis
- Timestamp:
- 11/07/06 09:12:49 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
r1715 r1717 293 293 Environment::GetSingleton()->GetIntValue("BvHierarchy.minRaysForVisibility", mMinRaysForVisibility); 294 294 295 //mUseBboxAreaForSah = false; 295 296 mUseBboxAreaForSah = true; 296 297 297 298 298 ///////////// … … 862 862 863 863 SortableEntryContainer::reverse_iterator rcit = 864 mSubdivisionCandidates->rbegin(), rcit_end = mSubdivisionCandidates->rend(); 864 mSubdivisionCandidates->rbegin(), rcit_end = 865 mSubdivisionCandidates->rend(); 865 866 866 867 vector<float>::reverse_iterator rbit = bordersRight.rbegin(); … … 892 893 893 894 const float renderCost = mViewCellsManager->EvalRenderCost(obj); 894 //const int renderCost = 1; 895 895 896 896 objectsLeft += renderCost; 897 897 objectsRight -= renderCost; … … 921 921 { 922 922 // just add up areas of the objects itself 923 // (as we are not sampling volumetric visibility,923 // As we are not sampling volumetric visibility, 924 924 // this should provide better heuristics 925 925 const float area = obj->GetArea();//obox.SurfaceArea(); … … 936 936 << lbox.SurfaceArea() << "," << rbox.SurfaceArea() << ")" << endl; 937 937 cout << "minborder: " << minBorder << " maxborder: " << maxBorder << endl; 938 cout << "cost= " << sum << endl; 939 */ 938 cout << "cost= " << sum << endl;*/ 940 939 941 940 if (sum < minSum) 942 { //cout <<" sum: " << sum;941 { 943 942 minSum = sum; 944 943 areaLeft = al; … … 950 949 } 951 950 952 //////////// ////////////////////////////////951 //////////// 953 952 //-- assign object to front and back volume 954 953 … … 964 963 float ratio = newCost / totalRenderCost; 965 964 966 #ifdef _DEBUG965 #ifdef GTP_DEBUG 967 966 cout << "\n\nobjects=(" << (int)objectsBack.size() << "," << (int)objectsFront.size() << " of " 968 967 << (int)tData.mNode->mObjects.size() << ")\t area=(" … … 973 972 return ratio; 974 973 } 974 975 975 #else 976 976 … … 1006 1006 vector<Vector3> bordersRight; 1007 1007 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]) 1025 1026 { 1026 if (obox.Min(i) < minBorder[i]) 1027 { 1028 minBorder[i] = obox.Min(i); 1029 } 1027 minBorder[i] = obox.Min(i); 1030 1028 } 1031 1032 (*rbit) = minBorder; 1033 }1029 } 1030 1031 (*rbit) = minBorder; 1034 1032 } 1035 1033 … … 1039 1037 1040 1038 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(); 1042 1041 1043 1042 for (cit = mSubdivisionCandidates->begin(); cit != cit_end; ++ cit, ++ bit) … … 1052 1051 const AxisAlignedBox3 obox = obj->GetBox(); 1053 1052 1054 if (mUseBboxAreaForSah)1055 {1056 AxisAlignedBox3 lbox = nodeBbox;1057 AxisAlignedBox3 rbox = nodeBbox;1058 1059 // the borders of the bounding boxes have changed1060 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]) 1061 1060 { 1062 if (obox.Max(i) > maxBorder[i]) 1063 { 1064 maxBorder[i] = obox.Max(i); 1065 } 1061 maxBorder[i] = obox.Max(i); 1066 1062 } 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 1087 1073 const bool noValidSplit = ((objectsLeft <= Limits::Small) || (objectsRight <= Limits::Small)); 1088 1074 const float sum = noValidSplit ? 1e25 : objectsLeft * al + objectsRight * ar; … … 1091 1077 << lbox.SurfaceArea() << "," << rbox.SurfaceArea() << ")" << endl; 1092 1078 cout << "minborder: " << minBorder << " maxborder: " << maxBorder << endl; 1093 cout << "cost= " << sum << endl; 1094 */ 1079 cout << "cost= " << sum << endl;*/ 1095 1080 1096 1081 if (sum < minSum) 1097 { //cout <<" sum: " << sum;1082 { 1098 1083 minSum = sum; 1099 1084 areaLeft = al; … … 1105 1090 } 1106 1091 1107 ///////////// ///////////////////////////////1092 ///////////// 1108 1093 //-- assign object to front and back volume 1109 1094 … … 1120 1105 1121 1106 #ifdef GTP_DEBUG 1122 // if (objectsBack.empty() ||objectsFront.empty())1123 1107 cout << "\n\nobjects=(" << (int)objectsBack.size() << "," << (int)objectsFront.size() << " of " 1124 1108 << (int)tData.mNode->mObjects.size() << ")\t area=(" … … 1153 1137 1154 1138 1155 static void PrintHeuristics(const int objectsRight,1139 static void PrintHeuristics(const float objectsRight, 1156 1140 const float sum, 1157 1141 const float volLeft, … … 1183 1167 { 1184 1168 /////////////////////////////////////////////////////// 1185 // 1169 //-- go through the lists, count the number of objects left 1186 1170 //-- and right and evaluate the cost funcion 1187 1171 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1716 r1717 5826 5826 Debug << "view cell evaluation samples: " << numSamples << endl; 5827 5827 Debug << "view cell stats prefix: " << statsPrefix << endl; 5828 Debug << "step size: " << splitsStepSize << endl; 5828 5829 5829 5830 cout << "reseting pvs ... "; -
GTP/trunk/Lib/Vis/Preprocessing/src/common.h
r1715 r1717 485 485 FileExists(char *filename); 486 486 487 #define GTP_DEBUG 0 487 //#define GTP_DEBUG 1 488 488 489 489 #define DEBUG_LEVEL 5
Note: See TracChangeset
for help on using the changeset viewer.