• Create Account

### #Actualgnomgrol

Posted 04 July 2012 - 05:35 AM

Hey guys,
My time is short, so Ill have to keep this short also:
I load position, normals, texturecoords and faces from .obj data. Works fine.
Now I need the indices, but i cant manage to calculate them proberly from the faces.
When I load a cude, the front and left side are not there.

Code looks like this:
(Code-Tags still not working thought)

int indexI; indexI = 0;

for(int i=0;i<faceCount;i++){
indices[indexI+1] = faceData[(i*4)+1]-1; //*4 cause every face has 4 vertices
indices[indexI+2] = faceData[(i*4)+2]-1; // faceData is just a list of all faces,
// eg: 1 2 3 4 5 8 7 6...

indices[indexI+3] = faceData[(i*4)]-1;
indices[indexI+4] = faceData[(i*4)+2]-1;
indices[indexI+5] = faceData[(i*4)+3]-1;
indexI += 6;
}

Can someone provide usefull information on this? Thanks

### #1gnomgrol

Posted 04 July 2012 - 05:34 AM

Hey guys,
My time is short, so Ill have to keep this short also:
I load position, normals, texturecoords and faces from .obj data. Works fine.
Now I need the indices, but i cant manage to calculate them proberly from the faces.
When I load a cude, the front and left side are not there.

Code looks like this:

[source lang="cpp"]int indexI; indexI = 0;for(int i=0;i<faceCount;i++){ indices[indexI] = faceData[(i*4)]-1; //-1 cause faces start with 1 indices[indexI+1] = faceData[(i*4)+1]-1; //*4 cause every face has 4 vertices indices[indexI+2] = faceData[(i*4)+2]-1; // faceData is just a list of all faces, // eg: 1 2 3 4 5 8 7 6... indices[indexI+3] = faceData[(i*4)]-1; indices[indexI+4] = faceData[(i*4)+2]-1; indices[indexI+5] = faceData[(i*4)+3]-1; indexI += 6;}[/source]

Can someone provide usefull information on this? Thanks

PARTNERS