Ogre2.1 OgreNewt show debug lines issue

Lax

24-08-2017 19:24:44

Hello all,

since Ogre2.x a manualobject will only be drawn, if a line index is set. But this messes up with the way vertices are transfered from newton.
This code did work with Ogre1.x:

void _CDECL Debugger::newtonPerPoly(void* userData, int vertexCount, const dFloat* faceVertec, int id)
{
Ogre::ManualObject* lines = (Ogre::ManualObject*)userData;
Ogre::Vector3 p0, p1;

if (vertexCount < 2)
return;

int i = vertexCount - 1;
p0 = Ogre::Vector3(faceVertec[(i * 3) + 0], faceVertec[(i * 3) + 1], faceVertec[(i * 3) + 2]);


for (i = 0; i < vertexCount; i++)
{
p1 = Ogre::Vector3(faceVertec[(i * 3) + 0], faceVertec[(i * 3) + 1], faceVertec[(i * 3) + 2]);

lines->position(p0);
lines->position(p1);
p0 = p1;
}
}

But since Ogre2.x it will never work. As the operation "lines->line(...)" is required. So I tried a lot of things like setting the line after the positions:

if (i < vertexCount - 1)
{
lines->line(i, i + 1);
}

But this will never work, as I think the order is not correct.
Has somebody an idea how to get this working again???

Regards
Lax