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

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<mesh.nNumVertex ; )

{

// 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

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

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

Thank you everyone.



To begin with knowledge of programming seems shallow to me.



I study more.

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 ..

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

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

wonderfull !!!

About the normal :


PVRTModelVertex *pSrcVertices = (PVRTModelVertex *)mesh.pInterleaved;<br />
<br />
for (unsigned int k=0; k < mesh.nNumVertex; k++)<br />
{<br />
const PVRTVec3 normal = pSrcVertices[k].normal;<br />
......<br />
}