Changeset 3267 for GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.cpp
- Timestamp:
- 01/11/09 13:34:37 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.cpp
r3266 r3267 504 504 if (mDynamicGeometrySize) 505 505 { 506 Update DynamicBranch(mDynamicRoot);506 UpdateBoundingBoxes(mDynamicRoot); 507 507 UpdateDynamicBounds(state); 508 508 } … … 874 874 cout << "created tighter bounds for " << p << " percent of the nodes" << endl; 875 875 876 // recreate indices used for indirect mode rendering876 // recreate indices used for indirect rendering mode 877 877 if (mIndices) CreateIndices(); 878 878 } … … 956 956 int numVirtualLeaves = 0; 957 957 int numGeometry = 0; 958 cout<<"here3 computing stats"<<endl; 958 959 959 while (!nodeStack.empty()) 960 960 { … … 962 962 nodeStack.pop(); 963 963 964 cout << "x";965 if (node->IsLeaf() && !node->IsVirtualLeaf())966 cerr << "here34"<<endl;967 968 964 if (node->IsVirtualLeaf()) 969 965 { … … 971 967 numGeometry += node->CountPrimitives(); 972 968 973 cout << " l " << numGeometry;974 969 BvhLeaf *leaf = static_cast<BvhLeaf *>(node); 975 970 … … 980 975 else 981 976 { 982 cout << "i";983 984 977 bvhStats.mInteriorSA += node->mBox.SurfaceArea(); 985 978 bvhStats.mInteriorVol += node->mBox.GetVolume(); … … 1090 1083 // assign new virtual leaves based on specified #triangles per leaf 1091 1084 std::stack<BvhNode *> nodeStack; 1092 nodeStack.push(m Root);1093 1094 cout << "here9" << endl; 1085 nodeStack.push(mStaticRoot); 1086 nodeStack.push(mDynamicRoot); 1087 1095 1088 while (!nodeStack.empty()) 1096 1089 { 1097 cout <<"u"<< endl;1098 1090 BvhNode *node = nodeStack.top(); 1099 1091 nodeStack.pop(); … … 1116 1108 (CountTriangles(node) <= numTriangles)) 1117 1109 { 1118 cout << " l " << CountTriangles(node) << " " << node->mIsMaxDepthForVirtualLeaf << endl;1110 //cout << " l " << CountTriangles(node) << " " << node->mIsMaxDepthForVirtualLeaf << endl; 1119 1111 node->mIsVirtualLeaf = true; 1120 1112 } … … 1145 1137 1146 1138 std::stack<BvhNode *> nodeStack; 1147 nodeStack.push(mRoot); 1148 1149 cout << "here7 computing depth" << endl; 1139 1140 nodeStack.push(mStaticRoot); 1141 nodeStack.push(mDynamicRoot); 1142 1150 1143 while (!nodeStack.empty()) 1151 1144 { 1152 1145 BvhNode *node = nodeStack.top(); 1153 1146 nodeStack.pop(); 1154 cout << "z"; 1147 1155 1148 if (node->IsLeaf()) 1156 1149 { … … 1166 1159 if ((f->mFirst == b->mFirst) && (f->mLast == b->mLast)) 1167 1160 { 1168 cout << "f: " << f->mFirst << " " << f->mLast << endl;1169 1161 // point reached where beyond there would be no further reduction 1170 1162 // as both subtrees contain the same objects => stop here … … 1180 1172 } 1181 1173 } 1182 cout << "here7" << endl;1183 1174 } 1184 1175 … … 1205 1196 1206 1197 BvhStats staticBvhStats; 1207 ComputeBvhStats(m Root, staticBvhStats);1198 ComputeBvhStats(mStaticRoot, staticBvhStats); 1208 1199 cout << "\n============ Static BVH statistics =============" << endl; 1209 1200 … … 1404 1395 1405 1396 1406 void Bvh::Update DynamicBranch(BvhNode *node)1397 void Bvh::UpdateBoundingBoxes(BvhNode *node) 1407 1398 { 1408 1399 if (node->IsLeaf()) … … 1419 1410 BvhNode *b = static_cast<BvhInterior *>(node)->GetBack(); 1420 1411 1421 Update DynamicBranch(f);1422 Update DynamicBranch(b);1412 UpdateBoundingBoxes(f); 1413 UpdateBoundingBoxes(b); 1423 1414 1424 1415 node->mBox = f->mBox; … … 1452 1443 } 1453 1444 1454 } 1445 1446 1447 1448 }
Note: See TracChangeset
for help on using the changeset viewer.