Could someone tell me what i'm missing? I thought I would see some triangle fan with a number of triangles proportional to the size of the circle...
Code: Select all
void ChipmunkDebugDrawCircle(cpVect pos, cpFloat angle, cpFloat radius, cpSpaceDebugColor outlineColor, cpSpaceDebugColor fillColor)
{
Triangle *triangles = PushTriangles(2);
cpFloat r = radius + 1.0f/ChipmunkDebugDrawPointLineScale;
Vertex a = {{(GLfloat)(pos.x - r), (GLfloat)(pos.y - r)}, {-1.0f, -1.0f}, fillColor, outlineColor};
Vertex b = {{(GLfloat)(pos.x - r), (GLfloat)(pos.y + r)}, {-1.0f, 1.0f}, fillColor, outlineColor};
Vertex c = {{(GLfloat)(pos.x + r), (GLfloat)(pos.y + r)}, { 1.0f, 1.0f}, fillColor, outlineColor};
Vertex d = {{(GLfloat)(pos.x + r), (GLfloat)(pos.y - r)}, { 1.0f, -1.0f}, fillColor, outlineColor};
Triangle t0 = {a, b, c}; triangles[0] = t0;
Triangle t1 = {a, c, d}; triangles[1] = t1;
ChipmunkDebugDrawSegment(pos, cpvadd(pos, cpvmult(cpvforangle(angle), radius - ChipmunkDebugDrawPointLineScale*0.5f)), outlineColor);
}