How from pInterleaved of SPODMesh, to get the vertex and normal.

This topic contains 8 replies, has 4 voices, and was last updated by  dgu 3 years, 12 months ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #31575

    s_yossun
    Member

    HAJIMEMASITE.
    I’m sorry I am Japanese.

    how to get the vertex and the normal from pInterleaved do not know.
    I was examined, but did not understand.

    I am trying to get in this way.

    for( int vertexIndex=0 ; vertexIndex
    {
    // Get the vertex A
    PVRTVECTOR4f pVertexA;
    PVRTVertexRead(&pVertexA, mesh.pInterleaved + (size_t)mesh.sVertex.pData + vertexIndex * mesh.sVertex.nStride, mesh.sVertex.eType, mesh.sVertex.n);
    // Get the normal A
    PVRTVECTOR4f pNormalA;
    PVRTVertexRead(&pNormalA, mesh.pInterleaved + (size_t)mesh.sNormals.pData + vertexIndex * mesh.sNormals.nStride, mesh.sNormals.eType, mesh.sNormals.n);
    vertexIndex ++;

    // Get the vertex B
    PVRTVECTOR4f pVertexB;
    PVRTVertexRead(&pVertexB, mesh.pInterleaved + (size_t)mesh.sVertex.pData + vertexIndex * mesh.sVertex.nStride, mesh.sVertex.eType, mesh.sVertex.n);
    // Get the normal B
    PVRTVECTOR4f pNormalB;
    PVRTVertexRead(&pNormalB, mesh.pInterleaved + (size_t)mesh.sNormals.pData + vertexIndex * mesh.sNormals.nStride, mesh.sNormals.eType, mesh.sNormals.n);
    vertexIndex ++;

    // Get the vertex C
    PVRTVECTOR4f pVertexC;
    PVRTVertexRead(&pVertexC, mesh.pInterleaved + (size_t)mesh.sVertex.pData + vertexIndex * mesh.sVertex.nStride, mesh.sVertex.eType, mesh.sVertex.n);
    // Get the normal C
    PVRTVECTOR4f pNormalC;
    PVRTVertexRead(&pNormalC, mesh.pInterleaved + (size_t)mesh.sNormals.pData + vertexIndex * mesh.sNormals.nStride, mesh.sNormals.eType, mesh.sNormals.n);
    vertexIndex ++;

    // Processing using the vertex
    NSLog(@”vertexA %f %f %f”, pVertexA.x, pVertexA.y, pVertexA.z );
    NSLog(@”vertexB %f %f %f”, pVertexB.x, pVertexB.y, pVertexB.z );
    NSLog(@”vertexC %f %f %f”, pVertexC.x, pVertexC.y, pVertexC.z );

    // Processing using the normal
    NSLog(@”normalA %f %f %f”, pNormalA.x, pNormalA.y, pNormalA.z );
    NSLog(@”normalB %f %f %f”, pNormalB.x, pNormalB.y, pNormalB.z );
    NSLog(@”normalC %f %f %f”, pNormalC.x, pNormalC.y, pNormalC.z );
    }

    But, I can not get data.

    Help me

    #38273

    Hi S_yossun,

    Your code looks correct, could you explain more what you mean by “But, I can not get data”?

    Unless your “mesh” argument is somehow invalid, all of your function calls are correct.

    Regards,
    Tobias

    #38274

    dgu
    Member

    will it be possible to add an examples showing how to create a pod file from scratch and extract this kind of information (when Indexed Triangle strips or not, extract indices , normal… etc etc) ? that could be wonderfull and very usefull

    regards
    david

    #38275

    s_yossun
    Member

    Thank you everyone.

    To begin with knowledge of programming seems shallow to me.

    I study more.

    #38276

    warmi
    Member

    will it be possible to add an examples showing how to create a pod file from scratch and extract this kind of information (when Indexed Triangle strips or not, extract indices , normal… etc etc) ? that could be wonderfull and very usefull

    regards
    david

    https://github.com/wrawdanik/LayoutPODExport/blob/master/src/Database.cpp

    If you look at bool SceneInventory::serializeToPODFile(QString fileName) , this method creates a completely new POD file from scratch , including animation nodes,vertices etc …
    It is a bit dated but it should given you an idea how to approach POD files ..

    #38277

    dgu
    Member

    very interesting about the implementation of serializeToPODFile thanks again .
    i wish they put it in the sdk as reference sample as well for all developers.

    KInd regards
    david

    #38278

    Hi David,

    Something like this will be included implicitly as part of the new tools we’re working on, as we’ll have a model class which does just this. The same should be true of all our file formats in the new SDK.

    Thanks,
    Tobias

    #38279

    dgu
    Member

    wonderfull !!!

    #38280

    dgu
    Member

    About the normal :

    PVRTModelVertex *pSrcVertices = (PVRTModelVertex *)mesh.pInterleaved;

    for (unsigned int k=0; k < mesh.nNumVertex; k++)
    {
    const PVRTVec3 normal = pSrcVertices[k].normal;
    ......
    }
Viewing 9 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic.