Has anyone written a btIDebugDraw for Irrlicht

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Adversus
Posts: 128
Joined: Sun Oct 05, 2008 10:58 pm
Contact:

Has anyone written a btIDebugDraw for Irrlicht

Post by Adversus »

There's an openGL one that come with the examples that I'm guessing I can use however for portability (when the OpenGL driver isn't used) it would be nice.

Has anyone taken the time to do this?

Cheers,
Adversus.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Who's btl, and where can it help?
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Last edited by rogerborg on Fri Nov 14, 2008 3:38 pm, edited 1 time in total.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Sylence
Posts: 725
Joined: Sat Mar 03, 2007 9:01 pm
Location: Germany
Contact:

Post by Sylence »

But btIDebugDraw does :o
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Sounds like the Debug draw methods one can enable for a scene node in Irrlicht 8)
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Check out CDebugRenderer.cpp in my IrrPhysx source, it's probably similar to that... In a way...

Basically it looks like you've just got to define functions that draw triangles and lines etc. If you look at IVideoDriver in the Irrlicht docs/API you should be able to figure out how to handle that.
Image Image Image
dlangdev
Posts: 1324
Joined: Tue Aug 07, 2007 7:28 pm
Location: Beaverton OR
Contact:

Post by dlangdev »

Yeah, I've seen this one and used that in one demo using Humus3D, it wasn't Irrlicht code. Irrlicht has its own debug renderer, tho.

Sorry if that didn't help.
Image
pc0de
Posts: 300
Joined: Wed Dec 05, 2007 4:41 pm

Post by pc0de »

Here's a modified version of what I'm using (debug lines only):

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)
    {
    }
}
m_debugNode is a custom scene node that is used to accumulate and render the debug lines. It's reset in the render loop. You can view sample code for it at: m_debugNode

A bit incomplete but hopefully you get the idea.
Post Reply