TAPs 0.7.7.3
TAPsBVHNodeLeafALinkFormedByTwoPointMasses.cpp
Go to the documentation of this file.
00001 /******************************************************************************
00002 TAPsBVHNodeLeafALinkFormedByTwoPointMasses.cpp
00003 ******************************************************************************/
00009 /******************************************************************************
00010 SUKITTI PUNAK   (08/16/2010)
00011 UPDATE          (08/20/2010)
00012 ******************************************************************************/
00013 #include "TAPsBVHNodeLeafALinkFormedByTwoPointMasses.hpp"
00014 // Using Inclusion Model (i.e. definitions are included in declarations)
00015 //                       (this name.cpp is included in name.hpp)
00016 // Each friend is defined directly inside its declaration.
00017 
00018 BEGIN_NAMESPACE_TAPs
00019 //=============================================================================
00020 // Constructor(s) and Destructor
00021 //-----------------------------------------------------------------------------
00022 template <typename T>
00023 BVHNodeLeafALinkFormedByTwoPointMasses<T>::BVHNodeLeafALinkFormedByTwoPointMasses (
00024     Enum::CD            type, 
00025     int                 id, 
00026     BVHNode<T> *        parent )
00027     : BVHNode<T>( id, type, parent ), 
00028       m_pPointMass_1( NULL ), m_pPointMass_2( NULL )
00029 {
00030     //m_bIsLeaf = true;
00031     m_iN = 0;
00032 }
00033 //-----------------------------------------------------------------------------
00034 template <typename T>
00035 BVHNodeLeafALinkFormedByTwoPointMasses<T>::~BVHNodeLeafALinkFormedByTwoPointMasses ()
00036 {}
00037 //-----------------------------------------------------------------------------
00038 // StrInfo
00039 template <typename T>
00040 std::string BVHNodeLeafALinkFormedByTwoPointMasses<T>::StrInfo () const
00041 {
00042     std::stringstream output;
00043     output  <<  "TAPs::BVHNodeLeafALinkFormedByTwoPointMasses<"
00044             <<  typeid(T).name() << "> Class:";
00045     //-------------------------------------------------
00046     output  << "contain the link formed by two point masses\n"
00047             << "PointMass 1: " << GetPtrToPrimitive_1() << "\n"
00048             << "PointMass 2: " << GetPtrToPrimitive_2() << "\n"
00049             << "\n";
00050     return output.str();
00051 }
00052 //-----------------------------------------------------------------------------
00053 //=============================================================================
00054 // Node Operations
00055 //-----------------------------------------------------------------------------
00056 // Update
00057 // update only this node
00058 template <typename T>
00059 void BVHNodeLeafALinkFormedByTwoPointMasses<T>::Update ()
00060 {
00061     //---------------------------------------------------------------
00062     switch ( m_eType ) {
00063         case Enum::BVH_NODE_LEAF_SPHERE_TWO_POINT_MASSES:
00064             UpdateSphere();
00065             break;
00066         case Enum::BVH_NODE_LEAF_AABB_TWO_POINT_MASSES:
00067             break;
00068         case Enum::BVH_NODE_LEAF_OBB_TWO_POINT_MASSES:
00069             break;
00070         default:
00071             assert( false );
00072             break;
00073     }
00074 }
00075 //-----------------------------------------------------------------------------
00076 // UpdateSphere
00077 template <typename T>
00078 void BVHNodeLeafALinkFormedByTwoPointMasses<T>::UpdateSphere ()
00079 {
00080     SetRadius( ( GetPtrToPrimitive_1()->GetPosition() - GetPtrToPrimitive_2()->GetPosition() ).Length() * T(0.5) );
00081     SetCenter( ( GetPtrToPrimitive_1()->GetPosition() + GetPtrToPrimitive_2()->GetPosition() ) * T(0.5) );
00082 }
00083 
00084 /*
00085 //-----------------------------------------------------------------------------
00086 // TestOverlapWith
00087 template <typename T>
00088 T BVHNodeLeafALinkFormedByTwoPointMasses<T>::TestOverlapWith ( BVHNode<T> const * const that ) const
00089 {
00090     switch ( m_eType ) {
00091         case Enum::BVH_NODE_BINARY_SPHERE:
00092         case Enum::BVH_NODE_QUAD_SPHERE:
00093         case Enum::BVH_NODE_OCTANT_SPHERE:
00094         case Enum::BVH_NODE_GENERIC_SPHERE:
00095         case Enum::BVH_NODE_LEAF_SPHERE_HALFEDGE_APRIM:
00096         case Enum::BVH_NODE_LEAF_SPHERE_HALFEDGE_PRIMS:
00097             switch ( that->GetType() ) {
00098                 case Enum::BVH_NODE_BINARY_SPHERE:
00099                 case Enum::BVH_NODE_QUAD_SPHERE:
00100                 case Enum::BVH_NODE_OCTANT_SPHERE:
00101                 case Enum::BVH_NODE_GENERIC_SPHERE:
00102                 case Enum::BVH_NODE_LEAF_SPHERE_HALFEDGE_APRIM:
00103                     return    ( GetCenter() - that->GetCenter() ).Length() 
00104                             - ( GetRadius() + that->GetRadius() );  // m_vW[0] is m_tRadius
00105                     break;
00106                 case Enum::BVH_NODE_LEAF_SPHERE_HALFEDGE_PRIMS:
00107                     return    ( GetCenter() - that->GetCenter() ).Length() 
00108                             - ( GetRadius() + that->GetRadius() );  // m_vW[0] is m_tRadius
00109                     break;
00110                 default:
00111                     std::cout << "Error: BVHNode<T>::TestOverlapWith Fn!" << std::endl;
00112                     assert( false );
00113                     break;
00114             }
00115             break;
00116         default:
00117             std::cout << "Error: BVHNode<T>::TestOverlapWith Fn!" << std::endl;
00118             assert( false );
00119             break;
00120     }
00121     return -777;    // -777 is an Error Code
00122 }
00123 //-----------------------------------------------------------------------------
00124 // TestOverlapSphereWithSphere #1
00125 template <typename T>
00126 T BVHNodeLeafALinkFormedByTwoPointMasses<T>::TestOverlapSphereWithSphere ( 
00127             BVHNode<T> const * const that ) const
00128 {
00129     std::cout << "BVHNodeLeafALinkFormedByTwoPointMasses<T>::TestOverlapSphereWithSphere( #1 )\n";
00130 
00131     if ( that->IsLeaf() ) {
00132         T distance = BVHNode<T>::TestOverlapSphereWithSphere( that );
00133         if ( distance > Math<T>::ZERO ) return distance;
00134         else {
00135             //-----------------------------------
00136             // Triangle Case
00137             HEFace<T> * face1 = this->GetAPrimitiveHalfEdgeFace();
00138             HEFace<T> * face2 = that->GetAPrimitiveHalfEdgeFace();
00139             if ( face1 && face2 ) {
00140                 // Assume Triangles
00141                 std::vector< Vector3<T> > tri1, tri2;
00142                 tri1 = face1->GetCopyOfVertexPositions( 3 );
00143                 tri2 = face2->GetCopyOfVertexPositions( 3 );
00144                 bool isIntersect = CGMath<T>::FindIntersectionTriangleTriangle( 
00145                         tri1[0], tri1[1], tri1[2], tri2[0], tri2[1], tri2[2] );
00146                 if ( isIntersect )  return -1;
00147                 else                return  1;
00148             }
00149             //-----------------------------------
00150             return distance;
00151         }
00152     }
00153     else {
00154         return BVHNode<T>::TestOverlapSphereWithSphere( that );
00155     }
00156 }
00157 //-----------------------------------------------------------------------------
00158 // TestOverlapSphereWithSphere #2
00159 template <typename T>
00160 T BVHNodeLeafALinkFormedByTwoPointMasses<T>::TestOverlapSphereWithSphere ( 
00161             BVHNode<T> const * const that, 
00162             Matrix4x4<T> const & thatTransform ) const
00163 {
00164     std::cout << "BVHNodeLeafALinkFormedByTwoPointMasses<T>::TestOverlapSphereWithSphere( #2 )\n";
00165 
00166     if ( that->IsLeaf() ) {
00167         T distance = BVHNode<T>::TestOverlapSphereWithSphere( that, thatTransform );
00168         if ( distance > Math<T>::ZERO ) return distance;
00169         else {
00170             //-----------------------------------
00171             // Triangle Case
00172             HEFace<T> * face1 = this->GetAPrimitiveHalfEdgeFace();
00173             HEFace<T> * face2 = that->GetAPrimitiveHalfEdgeFace();
00174             if ( face1 && face2 ) {
00175                 // Assume Triangles
00176                 std::vector< Vector3<T> > tri1, tri2;
00177                 tri1 = face1->GetCopyOfVertexPositions( 3 );
00178                 tri2 = face2->GetCopyOfVertexPositions( 3 );
00179                 //---------------------
00180                 // Transforms
00181                 tri2[0] = (thatTransform * Vector4<T>(tri2[0])).GetVector3();
00182                 tri2[1] = (thatTransform * Vector4<T>(tri2[1])).GetVector3();
00183                 tri2[2] = (thatTransform * Vector4<T>(tri2[2])).GetVector3();
00184                 //--------------------------
00185                 bool isIntersect = CGMath<T>::FindIntersectionTriangleTriangle( 
00186                         tri1[0], tri1[1], tri1[2], tri2[0], tri2[1], tri2[2] );
00187                 if ( isIntersect )  return -1;
00188                 else                return  1;
00189             }
00190             //-----------------------------------
00191             return distance;
00192         }
00193     }
00194     else {
00195         return BVHNode<T>::TestOverlapSphereWithSphere( that, thatTransform );
00196     }
00197 }
00198 //-----------------------------------------------------------------------------
00199 // TestOverlapSphereWithSphere #3
00200 template <typename T>
00201 T BVHNodeLeafALinkFormedByTwoPointMasses<T>::TestOverlapSphereWithSphere ( 
00202             Matrix4x4<T> const & thisTransform, 
00203             BVHNode<T> const * const that ) const
00204 {
00205     std::cout << "BVHNodeLeafALinkFormedByTwoPointMasses<T>::TestOverlapSphereWithSphere( #3 )\n";
00206 
00207     if ( that->IsLeaf() ) {
00208         T distance = BVHNode<T>::TestOverlapSphereWithSphere( thisTransform, that );
00209         if ( distance > Math<T>::ZERO ) return distance;
00210         else {
00211             //-----------------------------------
00212             // Triangle Case
00213             HEFace<T> * face1 = this->GetAPrimitiveHalfEdgeFace();
00214             HEFace<T> * face2 = that->GetAPrimitiveHalfEdgeFace();
00215             if ( face1 && face2 ) {
00216                 // Assume Triangles
00217                 std::vector< Vector3<T> > tri1, tri2;
00218                 tri1 = face1->GetCopyOfVertexPositions( 3 );
00219                 tri2 = face2->GetCopyOfVertexPositions( 3 );
00220                 //---------------------
00221                 // Transforms
00222                 tri1[0] = (thisTransform * Vector4<T>(tri1[0])).GetVector3();
00223                 tri1[1] = (thisTransform * Vector4<T>(tri1[1])).GetVector3();
00224                 tri1[2] = (thisTransform * Vector4<T>(tri1[2])).GetVector3();
00225                 //---------------------
00226                 bool isIntersect = CGMath<T>::FindIntersectionTriangleTriangle( 
00227                         tri1[0], tri1[1], tri1[2], tri2[0], tri2[1], tri2[2] );
00228                 if ( isIntersect )  return -1;
00229                 else                return  1;
00230             }
00231             //-----------------------------------
00232             return distance;
00233         }
00234     }
00235     else {
00236         return BVHNode<T>::TestOverlapSphereWithSphere( thisTransform, that );
00237     }
00238 }
00239 //-----------------------------------------------------------------------------
00240 // TestOverlapSphereWithSphere #4
00241 template <typename T>
00242 T BVHNodeLeafALinkFormedByTwoPointMasses<T>::TestOverlapSphereWithSphere ( 
00243             Matrix4x4<T> const & thisTransform, 
00244             BVHNode<T> const * const that, 
00245             Matrix4x4<T> const & thatTransform ) const
00246 {
00247     std::cout << "BVHNodeLeafALinkFormedByTwoPointMasses<T>::TestOverlapSphereWithSphere( #4 )\n";
00248 
00249     if ( that->IsLeaf() ) {
00250         T distance = BVHNode<T>::TestOverlapSphereWithSphere( thisTransform, that, thatTransform );
00251         if ( distance > Math<T>::ZERO ) return distance;
00252         else {
00253             //-----------------------------------
00254             // Triangle Case
00255             HEFace<T> * face1 = this->GetAPrimitiveHalfEdgeFace();
00256             HEFace<T> * face2 = that->GetAPrimitiveHalfEdgeFace();
00257             if ( face1 && face2 ) {
00258                 // Assume Triangles
00259                 std::vector< Vector3<T> > tri1, tri2;
00260                 tri1 = face1->GetCopyOfVertexPositions( 3 );
00261                 tri2 = face2->GetCopyOfVertexPositions( 3 );
00262                 //---------------------
00263                 // Transforms
00264                 tri1[0] = (thisTransform * Vector4<T>(tri1[0])).GetVector3();
00265                 tri1[1] = (thisTransform * Vector4<T>(tri1[1])).GetVector3();
00266                 tri1[2] = (thisTransform * Vector4<T>(tri1[2])).GetVector3();
00267                 tri2[0] = (thatTransform * Vector4<T>(tri2[0])).GetVector3();
00268                 tri2[1] = (thatTransform * Vector4<T>(tri2[1])).GetVector3();
00269                 tri2[2] = (thatTransform * Vector4<T>(tri2[2])).GetVector3();
00270                 //---------------------
00271                 bool isIntersect = CGMath<T>::FindIntersectionTriangleTriangle( 
00272                         tri1[0], tri1[1], tri1[2], tri2[0], tri2[1], tri2[2] );
00273                 if ( isIntersect )  return -1;
00274                 else                return  1;
00275             }
00276             //-----------------------------------
00277             return distance;
00278         }
00279     }
00280     else {
00281         return BVHNode<T>::TestOverlapSphereWithSphere( thisTransform, that, thatTransform );
00282     }
00283 }
00284 //-----------------------------------------------------------------------------
00285 //*/
00286 
00287 /*
00288 //-----------------------------------------------------------------------------
00289 // TestOverlapSphereWithBVSphere #1
00290 template <typename T>
00291 T BVHNodeLeafALinkFormedByTwoPointMasses<T>::TestOverlapSphereWithBVSphere ( 
00292     Vector3<T> const & centerOfBVSphere,    //!< I/P: the center of the 2nd sphere
00293     T radiusOfBVSphere                      //!< I/P: the radius of the 2nd sphere
00294 ) const
00295 {
00296     std::cout << "BVHNodeLeafALinkFormedByTwoPointMasses<T>::TestOverlapSphereWithBVSphere( #1 )\n";
00297 
00298     T distance = BVHNode<T>::TestOverlapSphereWithBVSphere( centerOfBVSphere, radiusOfBVSphere );
00299     if ( distance > Math<T>::ZERO ) return distance;
00300     else {
00301         //---------------------------------------
00302         // Triangle Case
00303         HEFace<T> * face = this->GetAPrimitiveHalfEdgeFace();
00304         if ( face ) {
00305             // Assume Triangles
00306             std::vector< Vector3<T> > tri;
00307             tri = face->GetCopyOfVertexPositions( 3 );
00308             //-------------------------
00309             bool isIntersect = CGMath<T>::FindIntersectionSphereTriangle( 
00310                     centerOfBVSphere, radiusOfBVSphere, tri[0], tri[1], tri[2] );
00311             if ( isIntersect )  return -1;
00312             else                return  1;
00313         }
00314         //---------------------------------------
00315         return distance;
00316     }
00317 }
00318 //-----------------------------------------------------------------------------
00319 // TestOverlapSphereWithBVSphere #2
00320 template <typename T>
00321 T BVHNodeLeafALinkFormedByTwoPointMasses<T>::TestOverlapSphereWithBVSphere ( 
00322     Matrix4x4<T> const & transformA,        //!< I/P: the transformation for the 1st sphere
00323     Vector3<T> const & centerOfBVSphere,    //!< I/P: the center of the 2nd sphere
00324     T radiusOfBVSphere                      //!< I/P: the radius of the 2nd sphere
00325 ) const
00326 {
00327     std::cout << "BVHNodeLeafALinkFormedByTwoPointMasses<T>::TestOverlapSphereWithBVSphere( #2 )\n";
00328 
00329     T distance = BVHNode<T>::TestOverlapSphereWithBVSphere( transformA, centerOfBVSphere, radiusOfBVSphere );
00330     if ( distance > Math<T>::ZERO ) return distance;
00331     else {
00332         //---------------------------------------
00333         // Triangle Case
00334         HEFace<T> * face = this->GetAPrimitiveHalfEdgeFace();
00335         if ( face ) {
00336             // Assume Triangles
00337             std::vector< Vector3<T> > tri;
00338             tri = face->GetCopyOfVertexPositions( 3 );
00339             //-------------------------
00340             // Transforms
00341             tri[0] = (transformA * Vector4<T>(tri[0])).GetVector3();
00342             tri[1] = (transformA * Vector4<T>(tri[1])).GetVector3();
00343             tri[2] = (transformA * Vector4<T>(tri[2])).GetVector3();
00344             //-------------------------
00345             bool isIntersect = CGMath<T>::FindIntersectionSphereTriangle( 
00346                     centerOfBVSphere, radiusOfBVSphere, tri[0], tri[1], tri[2] );
00347             if ( isIntersect )  return -1;
00348             else                return  1;
00349         }
00350         //---------------------------------------
00351         return distance;
00352     }
00353 }
00354 //-----------------------------------------------------------------------------
00355 //*/
00356 
00357 
00358 /*
00359 //-----------------------------------------------------------------------------
00360 // TestOverlapSphereWithBVCylinder #1
00361 template <typename T>
00362 bool BVHNodeLeafALinkFormedByTwoPointMasses<T>::TestOverlapSphereWithBVCylinder_AtOrigin ( 
00363     Vector3<T> const & centerOfBVCylinder,  //!< I/P: the center of the cylinder bounding volume
00364     T radiusOfBVCylinder,                   //!< I/P: the radius of the cylinder bounding volume
00365     T heightOfBVCylinder                    //!< I/P: the height of the cylinder bounding volume
00366 ) const
00367 {
00368     std::cout << "BVHNodeLeafALinkFormedByTwoPointMasses<T>::TestOverlapSphereWithBVCylinder( #1 )\n";
00369 
00370     T distance = BVHNode<T>::TestOverlapSphereWithBVCylinder_AtOrigin( radiusOfBVCylinder, heightOfBVCylinder );
00371     if ( distance > Math<T>::ZERO ) return false;
00372     else {
00373         //---------------------------------------
00374         // Triangle Case
00375         HEFace<T> * face = this->GetAPrimitiveHalfEdgeFace();
00376         if ( face ) {
00377             // Assume Triangles
00378             std::vector< Vector3<T> > tri;
00379             tri = face->GetCopyOfVertexPositions( 3 );
00380             //-------------------------
00381             T halfHeight = heightOfBVCylinder / 2;
00382             bool isIntersect = CGMath<T>::FindIntersectionCylinderTriangle( 
00383                     Vector3<T>(0,0,halfHeight), Vector3<T>(0,0,-halfHeight), radiusOfBVCylinder, tri[0], tri[1], tri[2] );
00384             if ( isIntersect )  return true;
00385             else                return false;
00386         }
00387         //---------------------------------------
00388         return true;
00389     }
00390 }
00391 //-----------------------------------------------------------------------------
00392 // TestOverlapSphereWithBVCylinder #2
00393 template <typename T>
00394 bool BVHNodeLeafALinkFormedByTwoPointMasses<T>::TestOverlapSphereWithBVCylinder_AtOrigin ( 
00395     Matrix4x4<T> const & transformA,        //!< I/P: the transformation for the node's sphere
00396     Vector3<T> const & centerOfBVCylinder,  //!< I/P: the center of the cylinder bounding volume
00397     T radiusOfBVCylinder,                   //!< I/P: the radius of the cylinder bounding volume
00398     T heightOfBVCylinder                    //!< I/P: the height of the cylinder bounding volume
00399 ) const
00400 {
00401     std::cout << "BVHNodeLeafALinkFormedByTwoPointMasses<T>::TestOverlapSphereWithBVCylinder( #2 )\n";
00402 
00403     T distance = BVHNode<T>::TestOverlapSphereWithBVCylinder_AtOrigin( transformA, radiusOfBVCylinder, heightOfBVCylinder );
00404     if ( distance > Math<T>::ZERO ) return false;
00405     else {
00406         //---------------------------------------
00407         // Triangle Case
00408         HEFace<T> * face = this->GetAPrimitiveHalfEdgeFace();
00409         if ( face ) {
00410             // Assume Triangles
00411             std::vector< Vector3<T> > tri;
00412             tri = face->GetCopyOfVertexPositions( 3 );
00413             //-------------------------
00414             // Transforms
00415             tri[0] = (transformA * Vector4<T>(tri[0])).GetVector3();
00416             tri[1] = (transformA * Vector4<T>(tri[1])).GetVector3();
00417             tri[2] = (transformA * Vector4<T>(tri[2])).GetVector3();
00418             //-------------------------
00419             T halfHeight = heightOfBVCylinder / 2;
00420             bool isIntersect = CGMath<T>::FindIntersectionCylinderTriangle( 
00421                     Vector3<T>(0,0,halfHeight), Vector3<T>(0,0,-halfHeight), radiusOfBVCylinder, tri[0], tri[1], tri[2] );
00422             if ( isIntersect )  return true;
00423             else                return false;
00424         }
00425         //---------------------------------------
00426         return true;
00427     }
00428 }
00429 //-----------------------------------------------------------------------------
00430 //*/
00431 
00432 
00433 #if defined(__gl_h_) || defined(__GL_H__)
00434 //=============================================================================
00435 // DrawByOpenGL
00436 //-----------------------------------------------------------------------------
00437 template <typename T>
00438 void BVHNodeLeafALinkFormedByTwoPointMasses<T>::DrawByOpenGL () const
00439 {
00440     //static OpenGL::Material mat;
00441     //mat.SetMaterial( OpenGL::Enum::METAL_BRONZE );
00442     //mat.ApplyMaterial( OpenGL::Enum::FRONT );
00443 
00444     //glDisable( GL_LIGHTING );
00445     //glColor3f( 0.3, 0.4, 0.5 );
00446     //---------------------------------------------------------------
00447     //if ( bDraw ) {    // DEBUG
00448     //  DrawBV();
00449     //  DrawPrim();         // DEBUG
00450     //  return;
00451     //}
00452     DrawBV();
00453     DrawPrim();         // DEBUG
00454     //---------------------------------------------------------------
00455     //glEnable( GL_LIGHTING );
00456 }
00457 //-----------------------------------------------------------------------------
00458 template <typename T>
00459 void BVHNodeLeafALinkFormedByTwoPointMasses<T>::DrawByOpenGL ( 
00460         int currentLevel, int startLevel, int endLevel ) const
00461 {
00462     if ( startLevel <= currentLevel && currentLevel <= endLevel ) {
00463         //static OpenGL::Material mat;
00464         //mat.SetMaterial( OpenGL::Enum::METAL_BRONZE );
00465         //mat.ApplyMaterial( OpenGL::Enum::FRONT );
00466 
00467         //glDisable( GL_LIGHTING );
00468         //glColor3f( 0.3, 0.4, 0.5 );
00469         //-----------------------------------------------------------
00470         //if ( listHEFace.size() == 1 )
00471         DrawBV();
00472         DrawPrim();     // DEBUG
00473     }
00474     //---------------------------------------------------------------
00475     //glEnable( GL_LIGHTING );
00476 }
00477 //-----------------------------------------------------------------------------
00478 template <typename T>
00479 void BVHNodeLeafALinkFormedByTwoPointMasses<T>::DrawBV ( GLenum drawStyle ) const
00480 {
00481     switch ( m_eType ) {
00482         //-----------------------------------------------------------
00483         // DRAW SPHERE BVH
00484         case Enum::BVH_NODE_LEAF_SPHERE_TWO_POINT_MASSES:
00485         case Enum::BVH_NODE_LEAF_SPHERE_UNSPECIFIED_PRIMS:
00486             DrawSphereBV( drawStyle );
00487             break;
00488         //-----------------------------------------------------------
00489         // DRAW AABB BVH
00490         case Enum::BVH_NODE_LEAF_AABB_TWO_POINT_MASSES:
00491         case Enum::BVH_NODE_LEAF_AABB_UNSPECIFIED_PRIMS:
00492             DrawAABBBV( drawStyle );
00493             break;
00494         //-----------------------------------------------------------
00495         // DRAW OBB BVH
00496         case Enum::BVH_NODE_LEAF_OBB_TWO_POINT_MASSES:
00497         case Enum::BVH_NODE_LEAF_OBB_UNSPECIFIED_PRIMS:
00498             DrawOBBBV( drawStyle );
00499             break;
00500     }
00501 }
00502 //-----------------------------------------------------------------------------
00503 //DEBUG-DEBUG-DEBUG-DEBUG-DEBUG-DEBUG-DEBUG-DEBUG-DEBUG-DEBUG-DEBUG-DEBUG-DEBUG
00504 template <typename T>
00505 void BVHNodeLeafALinkFormedByTwoPointMasses<T>::DrawPrim ( GLenum drawStyle ) const
00506 {
00507     if ( GetPtrToPrimitive_1() == NULL ) return;
00508 
00509     /*
00510     glDisable( GL_LIGHTING );
00511     //float div = RAND_MAX;
00512     //glColor3f( rand()/div, rand()/div, rand()/div );
00513     //glColor3f( 0.8, 0.8, 0.8 );
00514     glPushMatrix();
00515         HEHalfEdge<T> * firstHalfEdge, * halfEdge;
00516         Vector3<T> vertex;
00517         //-------------------------------------------
00518         // Draw The Half-Edge Face
00519         glBegin( GL_POLYGON );
00520         //glBegin( GL_LINE_LOOP );
00521             halfEdge = firstHalfEdge = m_primHEFace->IncidentHalfEdge();
00522             do {
00523                 vertex = halfEdge->Vertex()->GetPosition();
00524                 glVertex3f( vertex[0], vertex[1], vertex[2] );
00525                 halfEdge = halfEdge->Next();
00526             } while ( halfEdge != firstHalfEdge );
00527         glEnd();
00528         //-------------------------------------------
00529     glPopMatrix();
00530     glEnable( GL_LIGHTING );
00531     //*/
00532 }
00533 //DEBUG-DEBUG-DEBUG-DEBUG-DEBUG-DEBUG-DEBUG-DEBUG-DEBUG-DEBUG-DEBUG-DEBUG-DEBUG
00534 //-----------------------------------------------------------------------------
00535 #endif // #if defined(__gl_h_) || defined(__GL_H__)
00536 //=============================================================================
00537 END_NAMESPACE_TAPs
00538 //34567890123456789012345678901234567890123456789012345678901234567890123456789
00539 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines