compute Index sequence while TopoDS_Shape Triangulation

Dear,
how to compute Index sequence when I am doing TopoDS_Shape Triangulation? I am trying to convert TopoDS_Shape into Ogre mesh with right-handed coordination system.

code:
for (TopExp_Explorer ex(topoShape, TopAbs_FACE) ; ex.More(); ex.Next())
{
TopoDS_Face F = TopoDS::Face(ex.Current());
TopLoc_Location loc;
Handle_Poly_Triangulation facing = BRep_Tool::Triangulation(F,loc);

BRepGProp_Face prop2(F);

if(facing.IsNull() == Standard_False)
{
int ntriangles = facing->NbTriangles();

for (int j = 1; j {
Poly_Triangle triangle = (facing->Triangles())(j);
SetupIndex(m_tris, triscount++, triangle, vertscount);
}/// end for

int nbnodes = facing->NbNodes();

for (int i = 1; i {
gp_Pnt2d uv; gp_Pnt vertex, pnt; gp_Vec normal;

uv = (facing->UVNodes())(i);
vertex = (facing->Nodes())(i);

prop2.Normal(uv.X(), uv.Y(), pnt, normal);
SetupVertexBuffer(m_verts, vertscount, vertex, uv, normal);
vertscount += 1;
}/// end for
}/// end if

}/// end for

simoncheung's picture

and
void SetupIndex(IndexedTriangle* pit, int index, Poly_Triangle& pt, int base)
{
pit[index].t1 = pt(1) + base - 1;
pit[index].t2 = pt(2) + base - 1;
pit[index].t3 = pt(3) + base - 1;
}

void SetupVertexBuffer(VertexTriangle* pVT, int index, gp_Pnt& ver, gp_Pnt2d& uv, gp_Vec& normal)
{
pVT[index].x = ver.X();
pVT[index].y = ver.Y();
pVT[index].z = ver.Z();

normal.Normalize();
pVT[index].nx = normal.X();
pVT[index].ny = normal.Y();
pVT[index].nz = normal.Z();

pVT[index].u = uv.X();
pVT[index].v = uv.Y();
}