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

**URL:** <https://forums.imgtec.com/t/how-from-pinterleaved-of-spodmesh-to-get-the-vertex-and-normal/1953>\
**Category:** PowerVR Insider\
**Created:** [November 26, 2013, 5:36pm UTC](https://forums.imgtec.com/t/how-from-pinterleaved-of-spodmesh-to-get-the-vertex-and-normal/1953 "2013-11-26T17:36:18Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![s\_yossun](https://avatars.discourse-cdn.com/v4/letter/s/b19c9b/32.png) [@s\_yossun](https://forums.imgtec.com/u/s_yossun)\
**Post date:** [November 26, 2013, 5:36pm UTC](https://forums.imgtec.com/t/how-from-pinterleaved-of-spodmesh-to-get-the-vertex-and-normal/1953/1 "2013-11-26T17:36:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tobias](https://avatars.discourse-cdn.com/v4/letter/t/c67d28/32.png) [@tobias](https://forums.imgtec.com/u/tobias)\
**Post date:** [December 11, 2013, 9:24am UTC](https://forums.imgtec.com/t/how-from-pinterleaved-of-spodmesh-to-get-the-vertex-and-normal/1953/2 "2013-12-11T09:24:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dgu](https://avatars.discourse-cdn.com/v4/letter/d/94ad74/32.png) [@dgu](https://forums.imgtec.com/u/dgu)\
**Post date:** [December 11, 2013, 4:03pm UTC](https://forums.imgtec.com/t/how-from-pinterleaved-of-spodmesh-to-get-the-vertex-and-normal/1953/3 "2013-12-11T16:03:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![s\_yossun](https://avatars.discourse-cdn.com/v4/letter/s/b19c9b/32.png) [@s\_yossun](https://forums.imgtec.com/u/s_yossun)\
**Post date:** [December 12, 2013, 5:23am UTC](https://forums.imgtec.com/t/how-from-pinterleaved-of-spodmesh-to-get-the-vertex-and-normal/1953/4 "2013-12-12T05:23:56Z")

</div>

Thank you everyone.  
  
  
  
To begin with knowledge of programming seems shallow to me.  
  
  
  
I study more.

---

<div class="post-metadata">

**Author:** ![warmi](https://avatars.discourse-cdn.com/v4/letter/w/7ea924/32.png) [@warmi](https://forums.imgtec.com/u/warmi)\
**Post date:** [December 13, 2013, 7:30am UTC](https://forums.imgtec.com/t/how-from-pinterleaved-of-spodmesh-to-get-the-vertex-and-normal/1953/5 "2013-12-13T07:30:11Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dgu](https://avatars.discourse-cdn.com/v4/letter/d/94ad74/32.png) [@dgu](https://forums.imgtec.com/u/dgu)\
**Post date:** [December 13, 2013, 4:50pm UTC](https://forums.imgtec.com/t/how-from-pinterleaved-of-spodmesh-to-get-the-vertex-and-normal/1953/6 "2013-12-13T16:50:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tobias](https://avatars.discourse-cdn.com/v4/letter/t/c67d28/32.png) [@tobias](https://forums.imgtec.com/u/tobias)\
**Post date:** [December 13, 2013, 4:53pm UTC](https://forums.imgtec.com/t/how-from-pinterleaved-of-spodmesh-to-get-the-vertex-and-normal/1953/7 "2013-12-13T16:53:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dgu](https://avatars.discourse-cdn.com/v4/letter/d/94ad74/32.png) [@dgu](https://forums.imgtec.com/u/dgu)\
**Post date:** [December 13, 2013, 8:53pm UTC](https://forums.imgtec.com/t/how-from-pinterleaved-of-spodmesh-to-get-the-vertex-and-normal/1953/8 "2013-12-13T20:53:26Z")

</div>

wonderfull !!!

---

<div class="post-metadata">

**Author:** ![dgu](https://avatars.discourse-cdn.com/v4/letter/d/94ad74/32.png) [@dgu](https://forums.imgtec.com/u/dgu)\
**Post date:** [December 19, 2013, 12:02pm UTC](https://forums.imgtec.com/t/how-from-pinterleaved-of-spodmesh-to-get-the-vertex-and-normal/1953/9 "2013-12-19T12:02:42Z")

</div>

About the normal :

```auto
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 />
}

```
