Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualCorvwyn

Posted 08 October 2012 - 04:43 AM

I've been trying to load an md5 file with Assimp for a while with no luck. I've used some example code that loads a simple .obj file without assimp to make sure my directx 11 code for creating vertex/index buffers, shaders and textures works. It seems like the problem is in the LoadModel method somewhere. I've removed the DirectX 11 specific code, since I got this to work with the example I found.

I'm not that experienced with 3d programming yet, so maybe there's a simple solution to my problem. Maybe it's rendered far away somewhere outside my frustum even. The model I'm trying to render is simple, and has one aiMesh and 24 vertices.

My shaders take pos, texCoord, normal and tangents. I also have a light that illuminates the whole texture. The shader is rendered with DrawIndexed(indexCount, 0, 0). I can provide some more code if necessary.

Any ideas?

This is the code is use for loading the model with Assimp:
[source lang="cpp"]struct VertexType{ XMFLOAT3 position; XMFLOAT2 texture; XMFLOAT3 normal;};struct Mesh{ ID3D11Buffer* vertexBuffer; ID3D11Buffer* indexBuffer; Texture* texture; int indexCount;};bool Model::LoadModel(ID3D11Device* device, std::string filename){ HRESULT result;Assimp::Importer importer;const aiScene* scene = importer.ReadFile(filename, aiProcess_Triangulate | aiProcess_MakeLeftHanded | aiProcess_JoinIdenticalVertices | aiProcess_SortByPType | aiProcess_JoinIdenticalVertices | aiProcess_GenSmoothNormals | aiProcess_LimitBoneWeights | aiProcess_RemoveRedundantMaterials | aiProcess_OptimizeMeshes | aiProcess_GenUVCoords | aiProcess_TransformUVCoords);if(!scene){ MessageBoxA(nullptr, importer.GetErrorString(), "Error", MB_OK); return false;}meshes.reserve(scene->mNumMeshes);for( unsigned int m=0; m<scene->mNumMeshes; ++m ){ aiMesh* aiMesh = scene->mMeshes[m]; if(!aiMesh->HasNormals() || !aiMesh->HasTextureCoords(0)) { MessageBox(NULL, L"Model is missing normals or texture coordinates.", L"Error", MB_OK); return false; } Mesh mesh; D3D11_SUBRESOURCE_DATA vertexData, indexData; int vertexCount = aiMesh->mNumVertices; vector<VertexType> vertices(vertexCount); for(unsigned int i=0;i < (unsigned)vertexCount;++i) { vertices[i].position = XMFLOAT3(aiMesh->mVertices->x, aiMesh->mVertices->y, aiMesh->mVertices->z); vertices[i].normal = XMFLOAT3(aiMesh->mNormals->x, aiMesh->mNormals->y, aiMesh->mNormals->z); vertices[i].texture = XMFLOAT2(aiMesh->mTextureCoords[0][i].x, aiMesh->mTextureCoords[0][i].y); } mesh.indexCount = aiMesh->mNumFaces*3; vector<unsigned int> indices(aiMesh->mNumFaces); for (unsigned int i = 0; i < aiMesh->mNumFaces;++i) { const aiFace& Face = aiMesh->mFaces[i]; assert(Face.mNumIndices == 3); indices.push_back(Face.mIndices[0]); indices.push_back(Face.mIndices[1]); indices.push_back(Face.mIndices[2]); } int materialid = aiMesh->mMaterialIndex; aiMaterial* mat = scene->mMaterials[materialid]; aiString szPath; char diffuseName[150]; //diffuse texture if(AI_SUCCESS == aiGetMaterialString(mat, AI_MATKEY_TEXTURE_DIFFUSE(0), &szPath)) { strcpy(diffuseName, "../../Media/md5/"); strcat(diffuseName, szPath.data); } else { strcpy(diffuseName, "DEFAULTTEX"); } if(!(mesh.texture = LoadTexture(device, diffuseName))) { MessageBox(NULL, L"Could not load texture", L"Error", MB_OK); return false; }// Directx 11 code for creating vertex and index buffers etc[/source]
Edit: Removed tangents and some other code that was just there for testing.

#12Corvwyn

Posted 08 October 2012 - 04:42 AM

I've been trying to load an md5 file with Assimp for a while with no luck. I've used some example code that loads a simple .obj file without assimp to make sure my directx 11 code for creating vertex/index buffers, shaders and textures works. It seems like the problem is in the LoadModel method somewhere. I've removed the DirectX 11 specific code, since I got this to work with the example I found.

I'm not that experienced with 3d programming yet, so maybe there's a simple solution to my problem. Maybe it's rendered far away somewhere outside my frustum even. The model I'm trying to render is simple, and has one aiMesh and 24 vertices.

My shaders take pos, texCoord, normal and tangents. I also have a light that illuminates the whole texture. The shader is rendered with DrawIndexed(indexCount, 0, 0). I can provide some more code if necessary.

Any ideas?

This is the code is use for loading the model with Assimp:
[source lang="cpp"]struct VertexType{ XMFLOAT3 position; XMFLOAT2 texture; XMFLOAT3 normal; XMFLOAT3 tangent;};struct Mesh{ ID3D11Buffer* vertexBuffer; ID3D11Buffer* indexBuffer; Texture* texture; int indexCount;};bool Model::LoadModel(ID3D11Device* device, std::string filename){ HRESULT result;Assimp::Importer importer;const aiScene* scene = importer.ReadFile(filename, aiProcess_Triangulate | aiProcess_MakeLeftHanded | aiProcess_JoinIdenticalVertices | aiProcess_SortByPType | aiProcess_JoinIdenticalVertices | aiProcess_GenSmoothNormals | aiProcess_LimitBoneWeights | aiProcess_RemoveRedundantMaterials | aiProcess_OptimizeMeshes | aiProcess_GenUVCoords | aiProcess_TransformUVCoords);if(!scene){ MessageBoxA(nullptr, importer.GetErrorString(), "Error", MB_OK); return false;}meshes.reserve(scene->mNumMeshes);for( unsigned int m=0; m<scene->mNumMeshes; ++m ){ aiMesh* aiMesh = scene->mMeshes[m]; if(!aiMesh->HasNormals() || !aiMesh->HasTextureCoords(0)) { MessageBox(NULL, L"Model is missing normals or texture coordinates.", L"Error", MB_OK); return false; } Mesh mesh; D3D11_SUBRESOURCE_DATA vertexData, indexData; int vertexCount = aiMesh->mNumVertices; vector<VertexType> vertices(vertexCount); for(unsigned int i=0;i < (unsigned)vertexCount;++i) { vertices[i].position = XMFLOAT3(aiMesh->mVertices->x, aiMesh->mVertices->y, aiMesh->mVertices->z); vertices[i].normal = XMFLOAT3(aiMesh->mNormals->x, aiMesh->mNormals->y, aiMesh->mNormals->z); vertices[i].texture = XMFLOAT2(aiMesh->mTextureCoords[0][i].x, aiMesh->mTextureCoords[0][i].y); } mesh.indexCount = aiMesh->mNumFaces*3; vector<unsigned int> indices(aiMesh->mNumFaces); for (unsigned int i = 0; i < aiMesh->mNumFaces;++i) { const aiFace& Face = aiMesh->mFaces[i]; assert(Face.mNumIndices == 3); indices.push_back(Face.mIndices[0]); indices.push_back(Face.mIndices[1]); indices.push_back(Face.mIndices[2]); } int materialid = aiMesh->mMaterialIndex; aiMaterial* mat = scene->mMaterials[materialid]; aiString szPath; char diffuseName[150]; //diffuse texture if(AI_SUCCESS == aiGetMaterialString(mat, AI_MATKEY_TEXTURE_DIFFUSE(0), &szPath)) { strcpy(diffuseName, "../../Media/md5/"); strcat(diffuseName, szPath.data); } else { strcpy(diffuseName, "DEFAULTTEX"); } if(!(mesh.texture = LoadTexture(device, diffuseName))) { MessageBox(NULL, L"Could not load texture", L"Error", MB_OK); return false; }// Directx 11 code for creating vertex and index buffers etc[/source]
Edit: Removed tangents and some other code that was just there for testing.

#11Corvwyn

Posted 08 October 2012 - 04:42 AM

I've been trying to load an md5 file with Assimp for a while with no luck. I've used some example code that loads a simple .obj file without assimp to make sure my directx 11 code for creating vertex/index buffers, shaders and textures works. It seems like the problem is in the LoadModel method somewhere. I've removed the DirectX 11 specific code, since I got this to work with the example I found.

I'm not that experienced with 3d programming yet, so maybe there's a simple solution to my problem. Maybe it's rendered far away somewhere outside my frustum even. The model I'm trying to render is simple, and has one aiMesh and 24 vertices.

My shaders take pos, texCoord, normal and tangents. I also have a light that illuminates the whole texture. The shader is rendered with DrawIndexed(indexCount, 0, 0). I can provide some more code if necessary.

Any ideas?

This is the code is use for loading the model with Assimp:
[source lang="cpp"]struct VertexType{ XMFLOAT3 position; XMFLOAT2 texture; XMFLOAT3 normal; XMFLOAT3 tangent;};struct Mesh{ ID3D11Buffer* vertexBuffer; ID3D11Buffer* indexBuffer; Texture* texture; int indexCount;};bool Model::LoadModel(ID3D11Device* device, std::string filename){ HRESULT result;Assimp::Importer importer;const aiScene* scene = importer.ReadFile(filename, aiProcess_Triangulate | aiProcess_MakeLeftHanded | aiProcess_JoinIdenticalVertices | aiProcess_SortByPType | aiProcess_JoinIdenticalVertices | aiProcess_GenSmoothNormals | aiProcess_LimitBoneWeights | aiProcess_RemoveRedundantMaterials | aiProcess_OptimizeMeshes | aiProcess_GenUVCoords | aiProcess_TransformUVCoords);if(!scene){ MessageBoxA(nullptr, importer.GetErrorString(), "Error", MB_OK); return false;}meshes.reserve(scene->mNumMeshes);for( unsigned int m=0; m<scene->mNumMeshes; ++m ){ aiMesh* aiMesh = scene->mMeshes[m]; if(!aiMesh->HasNormals() || !aiMesh->HasTextureCoords(0)) { MessageBox(NULL, L"Model is missing normals or texture coordinates.", L"Error", MB_OK); return false; } Mesh mesh; D3D11_SUBRESOURCE_DATA vertexData, indexData; int vertexCount = aiMesh->mNumVertices; vector<VertexType> vertices(vertexCount); for(unsigned int i=0;i < (unsigned)vertexCount;++i) { vertices[i].position = XMFLOAT3(aiMesh->mVertices->x, aiMesh->mVertices->y, aiMesh->mVertices->z); vertices[i].normal = XMFLOAT3(aiMesh->mNormals->x, aiMesh->mNormals->y, aiMesh->mNormals->z); vertices[i].texture = XMFLOAT2(aiMesh->mTextureCoords[0][i].x, aiMesh->mTextureCoords[0][i].y); } mesh.indexCount = aiMesh->mNumFaces*3; vector<unsigned int> indices(aiMesh->mNumFaces); for (unsigned int i = 0; i < aiMesh->mNumFaces;++i) { const aiFace& Face = aiMesh->mFaces[i]; assert(Face.mNumIndices == 3); indices.push_back(Face.mIndices[0]); indices.push_back(Face.mIndices[1]); indices.push_back(Face.mIndices[2]); } int materialid = aiMesh->mMaterialIndex; aiMaterial* mat = scene->mMaterials[materialid]; aiString szPath; char diffuseName[150]; //diffuse texture if(AI_SUCCESS == aiGetMaterialString(mat, AI_MATKEY_TEXTURE_DIFFUSE(0), &szPath)) { strcpy(diffuseName, "../../Media/md5/"); strcat(diffuseName, szPath.data); } else { strcpy(diffuseName, "DEFAULTTEX"); } if(!(mesh.texture = LoadTexture(device, diffuseName))) { MessageBox(NULL, L"Could not load texture", L"Error", MB_OK); return false; }// Directx 11 code for creating vertex and index buffers etc[/source]
Edit: Removed tangents and some other code that shouldn't have been here.

#10Corvwyn

Posted 06 October 2012 - 07:57 AM

I've been trying to load an md5 file with Assimp for a while with no luck. I've used some example code that loads a simple .obj file without assimp to make sure my directx 11 code for creating vertex/index buffers, shaders and textures works. It seems like the problem is in the LoadModel method somewhere. I've removed the DirectX 11 specific code, since I got this to work with the example I found.

I'm not that experienced with 3d programming yet, so maybe there's a simple solution to my problem. Maybe it's rendered far away somewhere outside my frustum even. The model I'm trying to render is simple, and has one aiMesh and 24 vertices.

My shaders take pos, texCoord, normal and tangents. I also have a light that illuminates the whole texture. The shader is rendered with DrawIndexed(indexCount, 0, 0). I can provide some more code if necessary.

Any ideas?

This is the code is use for loading the model with Assimp:
[source lang="cpp"]struct VertexType{ XMFLOAT3 position; XMFLOAT2 texture; XMFLOAT3 normal; XMFLOAT3 tangent;};struct Mesh{ ID3D11Buffer* vertexBuffer; ID3D11Buffer* indexBuffer; Texture* texture; int indexCount;};bool Model::LoadModel(ID3D11Device* device, std::string filename){ HRESULT result;Assimp::Importer importer;const aiScene* scene = importer.ReadFile(filename, aiProcess_CalcTangentSpace | aiProcess_Triangulate | aiProcess_MakeLeftHanded | aiProcess_JoinIdenticalVertices | aiProcess_SortByPType | aiProcess_CalcTangentSpace | aiProcess_JoinIdenticalVertices | aiProcess_GenSmoothNormals | aiProcess_LimitBoneWeights | aiProcess_RemoveRedundantMaterials | aiProcess_OptimizeMeshes | aiProcess_GenUVCoords | aiProcess_TransformUVCoords);if(!scene){ MessageBoxA(nullptr, importer.GetErrorString(), "Error", MB_OK); return false;}meshes.reserve(scene->mNumMeshes);size_t nextVertex = 0;for( unsigned int m=0; m<scene->mNumMeshes; ++m ){ aiMesh* aiMesh = scene->mMeshes[m]; meshTransformation = TOXMFLOAT4X4(scene->mRootNode->FindNode("<MD5_Mesh>")->mTransformation); size_t meshStartIndex = nextVertex; if(!aiMesh->HasNormals() || !aiMesh->HasTextureCoords(0) || !aiMesh->HasTangentsAndBitangents()) { MessageBox(NULL, L"Model is missing normals, tangents or texture coordinates.", L"Error", MB_OK); return false; } Mesh mesh; D3D11_SUBRESOURCE_DATA vertexData, indexData; int vertexCount = aiMesh->mNumVertices; vector<VertexType> vertices(vertexCount); for(unsigned int i=0;i < (unsigned)vertexCount;++i) { vertices[i].position = XMFLOAT3(aiMesh->mVertices->x, aiMesh->mVertices->y, aiMesh->mVertices->z); vertices[i].normal = XMFLOAT3(aiMesh->mNormals->x, aiMesh->mNormals->y, aiMesh->mNormals->z); vertices[i].texture = XMFLOAT2(aiMesh->mTextureCoords[0][i].x, aiMesh->mTextureCoords[0][i].y); vertices[i].tangent = XMFLOAT3(aiMesh->mTangents->x, aiMesh->mTangents->y, aiMesh->mTangents->z); nextVertex++; } mesh.indexCount = aiMesh->mNumFaces*3; vector<unsigned int> indices(aiMesh->mNumFaces); for (unsigned int i = 0; i < aiMesh->mNumFaces;++i) { const aiFace& Face = aiMesh->mFaces[i]; assert(Face.mNumIndices == 3); indices.push_back(Face.mIndices[0] + meshStartIndex); indices.push_back(Face.mIndices[1] + meshStartIndex); indices.push_back(Face.mIndices[2] + meshStartIndex); } int materialid = aiMesh->mMaterialIndex; aiMaterial* mat = scene->mMaterials[materialid]; aiString szPath; char diffuseName[150]; //diffuse texture if(AI_SUCCESS == aiGetMaterialString(mat, AI_MATKEY_TEXTURE_DIFFUSE(0), &szPath)) { strcpy(diffuseName, "../../Media/md5/"); strcat(diffuseName, szPath.data); } else { strcpy(diffuseName, "DEFAULTTEX"); } if(!(mesh.texture = LoadTexture(device, diffuseName))) { MessageBox(NULL, L"Could not load texture", L"Error", MB_OK); return false; }// Directx 11 code for creating vertex and index buffers etc[/source]

#9Corvwyn

Posted 06 October 2012 - 07:54 AM

I've been trying to load an md5 file with Assimp for a while with no luck. I've used some example code that loads a simple .obj file without assimp to make sure my directx 11 code for creating vertex/index buffers, shaders and textures works. It seems like the problem is in the LoadModel method somewhere. I've removed the DirectX 11 specific code, since I got this to work with the example I found.

I'm not that experienced with 3d programming yet, so maybe there's a simple solution to my problem. Maybe it's rendered far away somewhere outside my frustum even. The model I'm trying to render is simple, and has one aiMesh and 24 vertices.

My shaders take pos, texCoord, normal and tangents. I also have a light that illuminates the whole texture. The shader is rendered with DrawIndexed(indexCount, 0, 0). I can provide some more code if necessary.

Any ideas?

This is the code is use for loading the model with Assimp:
[source lang="cpp"]struct VertexType{ XMFLOAT3 position; XMFLOAT2 texture; XMFLOAT3 normal; XMFLOAT3 tangent;};struct Mesh{ ID3D11Buffer* vertexBuffer; ID3D11Buffer* indexBuffer; Texture* texture; int indexCount;};bool Model::LoadModel(ID3D11Device* device, std::string filename){ HRESULT result;Assimp::Importer importer;const aiScene* scene = importer.ReadFile(filename, aiProcess_CalcTangentSpace | aiProcess_Triangulate | aiProcess_MakeLeftHanded | aiProcess_JoinIdenticalVertices | aiProcess_SortByPType | aiProcess_CalcTangentSpace | aiProcess_JoinIdenticalVertices | aiProcess_GenSmoothNormals | aiProcess_LimitBoneWeights | aiProcess_RemoveRedundantMaterials | aiProcess_OptimizeMeshes | aiProcess_GenUVCoords | aiProcess_TransformUVCoords);if(!scene){ MessageBoxA(nullptr, importer.GetErrorString(), "Error", MB_OK); return false;}meshes.reserve(scene->mNumMeshes);size_t nextVertex = 0;for( unsigned int m=0; m<scene->mNumMeshes; ++m ){ aiMesh* aiMesh = scene->mMeshes[m]; meshTransformation = TOXMFLOAT4X4(scene->mRootNode->FindNode("<MD5_Mesh>")->mTransformation); size_t meshStartIndex = nextVertex; if(!aiMesh->HasNormals() || !aiMesh->HasTextureCoords(0) || !aiMesh->HasTangentsAndBitangents()) { MessageBox(NULL, L"Model is missing normals, tangents or texture coordinates.", L"Error", MB_OK); return false; } Mesh mesh; D3D11_SUBRESOURCE_DATA vertexData, indexData; int vertexCount = aiMesh->mNumVertices; vector<VertexType> vertices(vertexCount); for(unsigned int i=0;i<vertexCount;++i) { vertices[i].position = XMFLOAT3(aiMesh->mVertices->x, aiMesh->mVertices->y, aiMesh->mVertices->z); vertices[i].normal = XMFLOAT3(aiMesh->mNormals->x, aiMesh->mNormals->y, aiMesh->mNormals->z); vertices[i].texture = XMFLOAT2(aiMesh->mTextureCoords[0][i].x, aiMesh->mTextureCoords[0][i].y); vertices[i].tangent = XMFLOAT3(aiMesh->mTangents->x, aiMesh->mTangents->y, aiMesh->mTangents->z); nextVertex++; } mesh.indexCount = aiMesh->mNumFaces*3; vector<unsigned int> indices(aiMesh->mNumFaces); for (unsigned int i = 0; i < aiMesh->mNumFaces;++i) { const aiFace& Face = aiMesh->mFaces[i]; assert(Face.mNumIndices == 3); indices.push_back(Face.mIndices[0] + meshStartIndex); indices.push_back(Face.mIndices[1] + meshStartIndex); indices.push_back(Face.mIndices[2] + meshStartIndex); } int materialid = aiMesh->mMaterialIndex; aiMaterial* mat = scene->mMaterials[materialid]; aiString szPath; char diffuseName[150]; //diffuse texture if(AI_SUCCESS == aiGetMaterialString(mat, AI_MATKEY_TEXTURE_DIFFUSE(0), &szPath)) { strcpy(diffuseName, "../../Media/md5/"); strcat(diffuseName, szPath.data); } else { strcpy(diffuseName, "DEFAULTTEX"); } if(!(mesh.texture = LoadTexture(device, diffuseName))) { MessageBox(NULL, L"Could not load texture", L"Error", MB_OK); return false; }// Directx 11 code for creating vertex and index buffers etc[/source]

#8Corvwyn

Posted 06 October 2012 - 07:52 AM

I've been trying to load an md5 file with Assimp for a while with no luck. I've used some example code that loads a simple .obj file without assimp to make sure my directx 11 code for creating vertex/index buffers, shaders and textures works. It seems like the problem is in the LoadModel method somewhere. I've removed the DirectX 11 specific code, since I got this to work with the example I found.

I'm not that experienced with 3d programming yet, so maybe there's a simple solution to my problem. Maybe it's rendered far away somewhere outside my frustum even. The model I'm trying to render is simple, and has one aiMesh and 24 vertices.

My shaders take pos, texCoord, normal and tangents. I also have a light that illuminates the whole texture. The shader is rendered with DrawIndexed(indexCount, 0, 0). I can provide some more code if necessary.

Any ideas?

This is the code is use for loading the model with Assimp:
[source lang="cpp"]struct VertexType{ XMFLOAT3 position; XMFLOAT2 texture; XMFLOAT3 normal; XMFLOAT3 tangent;};struct Mesh{ ID3D11Buffer* vertexBuffer; ID3D11Buffer* indexBuffer; Texture* texture; int indexCount;};bool Model::LoadModel(ID3D11Device* device, std::string filename){ HRESULT result;Assimp::Importer importer;const aiScene* scene = importer.ReadFile(filename, aiProcess_CalcTangentSpace | aiProcess_Triangulate | aiProcess_MakeLeftHanded | aiProcess_JoinIdenticalVertices | aiProcess_SortByPType | aiProcess_CalcTangentSpace | aiProcess_JoinIdenticalVertices | aiProcess_GenSmoothNormals | aiProcess_LimitBoneWeights | aiProcess_RemoveRedundantMaterials | aiProcess_OptimizeMeshes | aiProcess_GenUVCoords | aiProcess_TransformUVCoords);if(!scene){ MessageBoxA(nullptr, importer.GetErrorString(), "Error", MB_OK); return false;}meshes.reserve(scene->mNumMeshes);size_t nextVertex = 0;for( unsigned int m=0; m<scene->mNumMeshes; ++m ){ aiMesh* aiMesh = scene->mMeshes[m]; meshTransformation = TOXMFLOAT4X4(scene->mRootNode->FindNode("<MD5_Mesh>")->mTransformation); size_t meshStartIndex = nextVertex; if(!aiMesh->HasNormals() || !aiMesh->HasTextureCoords(0) || !aiMesh->HasTangentsAndBitangents()) { MessageBox(NULL, L"Model is missing normals, tangents or texture coordinates.", L"Error", MB_OK); return false; } Mesh mesh; D3D11_SUBRESOURCE_DATA vertexData, indexData; int vertexCount = aiMesh->mNumVertices; vector<VertexType> vertices(vertexCount); for(int i=0;i<vertexCount;++i) { vertices[i].position = XMFLOAT3(aiMesh->mVertices->x, aiMesh->mVertices->y, aiMesh->mVertices->z); vertices[i].normal = XMFLOAT3(aiMesh->mNormals->x, aiMesh->mNormals->y, aiMesh->mNormals->z); vertices[i].texture = XMFLOAT2(aiMesh->mTextureCoords[0][i].x, aiMesh->mTextureCoords[0][i].y); vertices[i].tangent = XMFLOAT3(aiMesh->mTangents->x, aiMesh->mTangents->y, aiMesh->mTangents->z); nextVertex++; } mesh.indexCount = aiMesh->mNumFaces*3; vector<unsigned int> indices(aiMesh->mNumFaces); for (unsigned int i = 0; i < aiMesh->mNumFaces;++i) { const aiFace& Face = aiMesh->mFaces[i]; assert(Face.mNumIndices == 3); indices.push_back(Face.mIndices[0] + meshStartIndex); indices.push_back(Face.mIndices[1] + meshStartIndex); indices.push_back(Face.mIndices[2] + meshStartIndex); } int materialid = aiMesh->mMaterialIndex; aiMaterial* mat = scene->mMaterials[materialid]; aiString szPath; char diffuseName[150]; //diffuse texture if(AI_SUCCESS == aiGetMaterialString(mat, AI_MATKEY_TEXTURE_DIFFUSE(0), &szPath)) { strcpy(diffuseName, "../../Media/md5/"); strcat(diffuseName, szPath.data); } else { strcpy(diffuseName, "DEFAULTTEX"); } if(!(mesh.texture = LoadTexture(device, diffuseName))) { MessageBox(NULL, L"Could not load texture", L"Error", MB_OK); return false; }// Directx 11 code for creating vertex and index buffers etc[/source]

PARTNERS