Changeset 2764 for GTP/trunk/App/Demos/Vis/CHC_revisited/Bvh.cpp
- Timestamp:
- 06/17/08 03:47:02 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/CHC_revisited/Bvh.cpp
r2763 r2764 366 366 // store near plane 367 367 sNearPlane = Plane3(mCamera->GetDirection(), mCamera->GetPosition()); 368 // Debug << "near: " << sNearPlane << " d " << mCamera->GetDirection() << " " << mCamera->GetPosition() << std::endl; 369 // for (int i = 0; i < 6; ++ i) Debug << "plane: " << sFrustum.mClipPlanes[i] << std::endl; 370 } 371 372 373 float Bvh::CalcDistance(BvhNode *node) const 374 { 375 return node->GetBox().GetMinVisibleDistance(sNearPlane); 368 } 369 370 371 void Bvh::CalcDistance(BvhNode *node) const 372 { 373 node->mDistance = node->GetBox().GetMinVisibleDistance(sNearPlane); 376 374 } 377 375 … … 872 870 } 873 871 872 mNumVirtualNodes = 0; 873 874 874 // assign new virtual leaves based on specified number of triangles per leaf 875 875 std::stack<BvhNode *> nodeStack; … … 880 880 BvhNode *node = nodeStack.top(); 881 881 nodeStack.pop(); 882 883 ++ mNumVirtualNodes; 882 884 883 885 if (node->IsLeaf()) … … 948 950 const Vector3 u = box.Max(); 949 951 950 /////////// 951 //-- render AABB as triangle strips 952 953 glVertex3f(l.x, l.y, u.z); 954 glVertex3f(u.x, l.y, u.z); 955 glVertex3f(l.x, u.y, u.z); 956 glVertex3f(u.x, u.y, u.z); 957 glVertex3f(l.x, u.y, l.z); 958 glVertex3f(u.x, u.y, l.z); 959 glVertex3f(l.x, l.y, l.z); 960 glVertex3f(u.x, l.y, l.z); 961 962 glPrimitiveRestartNV(); 963 964 //-- render second half of AABB 965 glVertex3f(l.x, u.y, u.z); 966 glVertex3f(l.x, u.y, l.z); 967 glVertex3f(l.x, l.y, u.z); 968 glVertex3f(l.x, l.y, l.z); 969 glVertex3f(u.x, l.y, u.z); 970 glVertex3f(u.x, l.y, l.z); 971 glVertex3f(u.x, u.y, u.z); 972 glVertex3f(u.x, u.y, l.z); 973 } 974 975 976 977 } 952 glBegin(GL_TRIANGLE_STRIP); 953 { 954 /////////// 955 //-- render AABB as triangle strips 956 957 glVertex3f(l.x, l.y, u.z); 958 glVertex3f(u.x, l.y, u.z); 959 glVertex3f(l.x, u.y, u.z); 960 glVertex3f(u.x, u.y, u.z); 961 glVertex3f(l.x, u.y, l.z); 962 glVertex3f(u.x, u.y, l.z); 963 glVertex3f(l.x, l.y, l.z); 964 glVertex3f(u.x, l.y, l.z); 965 966 glPrimitiveRestartNV(); 967 968 //-- render second half of AABB 969 glVertex3f(l.x, u.y, u.z); 970 glVertex3f(l.x, u.y, l.z); 971 glVertex3f(l.x, l.y, u.z); 972 glVertex3f(l.x, l.y, l.z); 973 glVertex3f(u.x, l.y, u.z); 974 glVertex3f(u.x, l.y, l.z); 975 glVertex3f(u.x, u.y, u.z); 976 glVertex3f(u.x, u.y, l.z); 977 } 978 glEnd(); 979 } 980 981 }
Note: See TracChangeset
for help on using the changeset viewer.