Code: Select all
static void BulletToIrr(const btVector3& in, vector3df& result)
{
result.set(in.getX(),in.getY(),-in.getZ());
}
class BulletDebugDraw : public btIDebugDraw
{
public:
//
// debug functionality
//
void drawLine(const btVector3& from,const btVector3& to,const btVector3& color);
{
vector3df v1,v2;
BulletToIrr(from,v1);
BulletToIrr(to,v2);
// handle bullet simplex debug color bug...
SColor icolor((u32)color.x()*255.0, (u32)color.y()*255.0, (u32)color.z()*255.0);
S3DVertex vert1(v1,v1,icolor,vector2df());
S3DVertex vert2(v2,v2,icolor,vector2df());
m_debugNode->addLine(vert1,vert2);
}
void drawContactPoint(const btVector3& PointOnB,const btVector3& normalOnB,float distance,int lifeTime,const btVector3& color)
{
}
void draw3dText(const btVector3& location,const char* textString)
{
}
}
The second example I located shows the following example code:
Code: Select all
void BulletDebugRender::drawLine( const btVector3& from,const btVector3& to, const btVector3& color )
{
drawLine(from, to, color, color);
}
void BulletDebugRender::drawLine( const btVector3& from,const btVector3& to, const btVector3& fromColor, const btVector3& toColor )
{
SColorf fromC; fromC.set(fromColor[0],fromColor[1],fromColor[2],fromColor[3]);
SColorf toC; toC.set(toColor[0],toColor[1],toColor[2],toColor[3]);
Graphics->drawLine(from, to, fromC, toC);
}
// Implementation of Graphics::drawLine
void Graphics::drawLine( const vector3df &from, const vector3df &to, const SColorf &fromColor, const SColorf &tocolor )
{
matrix4 id;
id.makeIdentity();
m_Driver->setTransform(video::ETS_WORLD, id);
m_Driver->draw3DLine(from, to, fromColor.toSColor());
}
If I am correct in my assumptions and both examples are working as I have explained, which method should be preferred to draw the lines to the screen?