Back to index

supertuxkart  0.5+dfsg1
Public Types | Public Member Functions | Private Attributes
GLDebugDrawer Class Reference

#include <GLDebugDrawer.h>

Inheritance diagram for GLDebugDrawer:
Inheritance graph
[legend]
Collaboration diagram for GLDebugDrawer:
Collaboration graph
[legend]

List of all members.

Public Types

enum  DebugDrawModes {
  DBG_NoDebug = 0, DBG_DrawWireframe = 1, DBG_DrawAabb = 2, DBG_DrawFeaturesText = 4,
  DBG_DrawContactPoints = 8, DBG_NoDeactivation = 16, DBG_NoHelpText = 32, DBG_DrawText = 64,
  DBG_ProfileTimings = 128, DBG_EnableSatComparison = 256, DBG_DisableBulletLCP = 512, DBG_EnableCCD = 1024,
  DBG_MAX_DEBUG_DRAW_MODE
}

Public Member Functions

 GLDebugDrawer ()
virtual void drawLine (const btVector3 &from, const btVector3 &to, const btVector3 &color)
virtual void drawContactPoint (const btVector3 &PointOnB, const btVector3 &normalOnB, btScalar distance, int lifeTime, const btVector3 &color)
virtual void reportErrorWarning (const char *warningString)
virtual void draw3dText (const btVector3 &location, const char *textString)
virtual void setDebugMode (int debugMode)
virtual int getDebugMode () const
virtual void drawTriangle (const btVector3 &v0, const btVector3 &v1, const btVector3 &v2, const btVector3 &n0, const btVector3 &n1, const btVector3 &n2, const btVector3 &color, btScalar alpha)
virtual void drawTriangle (const btVector3 &v0, const btVector3 &v1, const btVector3 &v2, const btVector3 &color, btScalar alpha)
void drawAabb (const btVector3 &from, const btVector3 &to, const btVector3 &color)

Private Attributes

int m_debugMode

Detailed Description

Definition at line 8 of file GLDebugDrawer.h.


Member Enumeration Documentation

enum btIDebugDraw::DebugDrawModes [inherited]
Enumerator:
DBG_NoDebug 
DBG_DrawWireframe 
DBG_DrawAabb 
DBG_DrawFeaturesText 
DBG_DrawContactPoints 
DBG_NoDeactivation 
DBG_NoHelpText 
DBG_DrawText 
DBG_ProfileTimings 
DBG_EnableSatComparison 
DBG_DisableBulletLCP 
DBG_EnableCCD 
DBG_MAX_DEBUG_DRAW_MODE 

Definition at line 38 of file btIDebugDraw.h.


Constructor & Destructor Documentation

Definition at line 20 of file GLDebugDrawer.cpp.

:m_debugMode(0)
{

}

Member Function Documentation

void GLDebugDrawer::draw3dText ( const btVector3 location,
const char *  textString 
) [virtual]

Implements btIDebugDraw.

Definition at line 43 of file GLDebugDrawer.cpp.

{
       glRasterPos3f(location.x(),  location.y(),  location.z());
       BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),textString);
}

Here is the call graph for this function:

void btIDebugDraw::drawAabb ( const btVector3 from,
const btVector3 to,
const btVector3 color 
) [inline, inherited]

Definition at line 80 of file btIDebugDraw.h.

       {

              btVector3 halfExtents = (to-from)* 0.5f;
              btVector3 center = (to+from) *0.5f;
              int i,j;

              btVector3 edgecoord(1.f,1.f,1.f),pa,pb;
              for (i=0;i<4;i++)
              {
                     for (j=0;j<3;j++)
                     {
                            pa = btVector3(edgecoord[0]*halfExtents[0], edgecoord[1]*halfExtents[1],            
                                   edgecoord[2]*halfExtents[2]);
                            pa+=center;

                            int othercoord = j%3;
                            edgecoord[othercoord]*=-1.f;
                            pb = btVector3(edgecoord[0]*halfExtents[0], edgecoord[1]*halfExtents[1],     
                                   edgecoord[2]*halfExtents[2]);
                            pb+=center;

                            drawLine(pa,pb,color);
                     }
                     edgecoord = btVector3(-1.f,-1.f,-1.f);
                     if (i<3)
                            edgecoord[i]*=-1.f;
              }
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void GLDebugDrawer::drawContactPoint ( const btVector3 PointOnB,
const btVector3 normalOnB,
btScalar  distance,
int  lifeTime,
const btVector3 color 
) [virtual]

Implements btIDebugDraw.

Definition at line 54 of file GLDebugDrawer.cpp.

{
       if (m_debugMode & btIDebugDraw::DBG_DrawContactPoints)
       {
              btVector3 to=pointOnB+normalOnB*distance;
              const btVector3&from = pointOnB;
              glBegin(GL_LINES);
              glColor3f(color.getX(), color.getY(), color.getZ());
              glVertex3d(from.getX(), from.getY(), from.getZ());
              glVertex3d(to.getX(), to.getY(), to.getZ());
              glEnd();


              glRasterPos3f(from.x(),  from.y(),  from.z());
              char buf[12];
              sprintf(buf," %d",lifeTime);
              BMF_DrawString(BMF_GetFont(BMF_kHelvetica10),buf);


       }
}

Here is the call graph for this function:

void GLDebugDrawer::drawLine ( const btVector3 from,
const btVector3 to,
const btVector3 color 
) [virtual]

Implements btIDebugDraw.

Definition at line 25 of file GLDebugDrawer.cpp.

{
//     if (m_debugMode > 0)
       {
              glBegin(GL_LINES);
              glColor3f(color.getX(), color.getY(), color.getZ());
              glVertex3d(from.getX(), from.getY(), from.getZ());
              glVertex3d(to.getX(), to.getY(), to.getZ());
              glEnd();
       }
}

Here is the call graph for this function:

virtual void btIDebugDraw::drawTriangle ( const btVector3 v0,
const btVector3 v1,
const btVector3 v2,
const btVector3 n0,
const btVector3 n1,
const btVector3 n2,
const btVector3 color,
btScalar  alpha 
) [inline, virtual, inherited]

Definition at line 59 of file btIDebugDraw.h.

       {
              drawTriangle(v0,v1,v2,color,alpha);
       }
virtual void btIDebugDraw::drawTriangle ( const btVector3 v0,
const btVector3 v1,
const btVector3 v2,
const btVector3 color,
btScalar  alpha 
) [inline, virtual, inherited]

Definition at line 63 of file btIDebugDraw.h.

       {
              drawLine(v0,v1,color);
              drawLine(v1,v2,color);
              drawLine(v2,v0,color);
       }

Here is the call graph for this function:

virtual int GLDebugDrawer::getDebugMode ( ) const [inline, virtual]

Implements btIDebugDraw.

Definition at line 27 of file GLDebugDrawer.h.

{ return m_debugMode;}
void GLDebugDrawer::reportErrorWarning ( const char *  warningString) [virtual]

Implements btIDebugDraw.

Definition at line 49 of file GLDebugDrawer.cpp.

{
       printf(warningString);
}
void GLDebugDrawer::setDebugMode ( int  debugMode) [virtual]

Implements btIDebugDraw.

Definition at line 37 of file GLDebugDrawer.cpp.

{
       m_debugMode = debugMode;

}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 10 of file GLDebugDrawer.h.


The documentation for this class was generated from the following files: