POD triangle Indice

This topic contains 4 replies, has 2 voices, and was last updated by  dgu 4 years, 9 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #31195


    Dear Team

    When the type of export is indexed triangle list or indexed triangle strips ,i wish to get the indice to be able to feed directly my physics engine (build a custom meshes directly from POD) .
    i need the indice and the position of each vertex
    The section 4.2 of the documentation is quite obscure for me now expcept the default value to set 😉

    for(unsigned int i = 0; i < mesh.nNumFaces * 3; i += 3)
    unsigned char *pData = mesh.sFaces.pData + i * mesh.sFaces.nStride;

    in The Shaman Tools all this data are displayed when of course you select the right type during the pod creation
    do you have piece of code that build a pod from scratch by an easy way……?

    any answer are welcom,

    Kind regards



    One solution is on the old code of the extra package
    bool Mesh::ConvertToLines() show the technic




    In your example code if you change pData to be an unsigned short pointer or unsigned int pointer, depending on whether your POD is using 16-bit or 32-bit indices, will give you your indices ([0],[1],[2]) for face i / 3.

    Then, with these indices you can index into mesh.sVertices.pdata or mesh. pInterleaved depending on if your data is non-interleaved or interleaved in a similar way to get your vertex positions.

    do you have piece of code that build a pod from scratch by an easy way……?

    We provide helper functions for converting the data, interleaving, deinterleaving the vertex data, deindexing as well as other things. Could you elaborate more on what you’re trying to achieve?





    Hello Scott

    i use obj format to get indice and vertex but to avoid duplication i would to use only POD,be able to create my dynamic mesh from POD only, witch could be a nice connector for external physic engine .Sure there is other format but i am only interested by POD.

    The Context :
    to create a kind of dynamic shape in bullet you do :

    int totalVerts = 633;
    btVector3* m_vertices = new btVector3[totalVerts];
    int* gIndices = new int[totalTriangles*3];
    btTriangleMesh* trimesh = new btTriangleMesh();
    trimesh->addTriangle(btVector3 (-322.567,72.5652,133.36),btVector3 (-291.543,73.1621,133.401),btVector3 (-291.929,72.2013,114.977));

    etc etc

    The Problem:
    you must then access to the faces and extract the 3 points sort by indice.the Shaman is displaying this data in the databiewver when you export in index mode of course but getting this data is hot.

    solution ?

    // Triangles a have 3 corners on the whole

    unsigned int u32IndexCount = m_psMesh->nNumFaces*3;
    unsigned char* pNewIndices = (unsigned char*)malloc(u32IndexCount*sizeof(unsigned char)*2);
    unsigned short* pSrcPointer = (unsigned short*)m_psMesh->sFaces.pData,
    *pDstPointer = (unsigned short*)pNewIndices;

    for(unsigned int i=0;inNumFaces;i++)
    { // tri ABC lines ABBCCA


    how can get the position of A B C ????




    everyhting is fine

Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic.