Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualRalara

Posted 06 October 2012 - 07:28 AM

This for loop looks a little strange to me:

for(unsigned int i=0;imVertices->x, aiMesh->mVertices->y, aiMesh->mVertices->z);


The semi-colon at the end of the loop means it won't actually loop through the code, it will only process it once, and what is 'imVertices'.

But the reason I don't think you're seeing anything on the screen is you aren't getting the vertex positions when loading (I'm wondering whether there is a mis-copy with the aforementioned for-loop, because you do use aiMesh->mVertices->x / y/ z). If the for-loop has been mis-copied then the following advice won't help and its possible something is going wrong when you are rendering, otherwise the loading code I use for assimp is as follows:
[source lang="cpp"]for (UINT i=0; i < numVertices; i++){ const aiVector3D* pos = &(inMesh->mVertices[i]); const aiVector3D* normal = &(inMesh->mNormals[i]); const aiVector3D* texCoord; if (inMesh->HasTextureCoords(0)) texCoord = &(inMesh->mTextureCoords[0][i]); else texCoord = new aiVector3D(0.0f, 0.0f, 0.0f); Vertex v; v.mPos = XMFLOAT3(pos->x, pos->y, pos->z); v.mNormal = XMFLOAT3(normal->x, normal->y, normal->z); v.mTexCoord = XMFLOAT2(texCoord->x, texCoord->y); vertices.push_back(v);}[/source]

Ralara

#1Ralara

Posted 06 October 2012 - 07:27 AM

This for loop looks a little strange to me:

for(unsigned int i=0;imVertices->x, aiMesh->mVertices->y, aiMesh->mVertices->z);


The semi-colon at the end of the loop means it won't actually loop through the code, it will only process it once, and what is 'imVertices'.

But the reason I don't think you're seeing anything on the screen is you aren't getting the vertex positions when loading (I'm wondering whether there is a mis-copy with the aforementioned for-loop, because you do use aiMesh->mVertices->x / y/ z. If the for-loop has been mis-copied then the following advice won't help and its possible something is going wrong when you are rendering, otherwise the loading code I use for assimp is as follows:
[source lang="cpp"]for (UINT i=0; i < numVertices; i++){ const aiVector3D* pos = &(inMesh->mVertices[i]); const aiVector3D* normal = &(inMesh->mNormals[i]); const aiVector3D* texCoord; if (inMesh->HasTextureCoords(0)) texCoord = &(inMesh->mTextureCoords[0][i]); else texCoord = new aiVector3D(0.0f, 0.0f, 0.0f); Vertex v; v.mPos = XMFLOAT3(pos->x, pos->y, pos->z); v.mNormal = XMFLOAT3(normal->x, normal->y, normal->z); v.mTexCoord = XMFLOAT2(texCoord->x, texCoord->y); vertices.push_back(v);}[/source]

Ralara

PARTNERS