• Advertisement
Sign in to follow this  

[Assimp/Direct3D] 3DS Models

This topic is 2402 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,

I have a problem with Assimp and Direct3D.

I tried with OBJ and 3DS models. The OBJ models has loaded without problems but some 3DS models loaded wrong.

Like this:

thump_6705921errorassimp3ds.jpg

thump_6705928errorassimp3ds1.jpg

This is de code for the load of the model.


const struct aiScene* scene = NULL;

Assimp::Importer importer;

scene = importer.ReadFile( fileName,
aiProcess_CalcTangentSpace |
aiProcess_Triangulate |
aiProcess_JoinIdenticalVertices |
aiProcess_SortByPType |
aiProcess_CalcTangentSpace |
aiProcess_JoinIdenticalVertices |
aiProcess_GenSmoothNormals |
aiProcess_LimitBoneWeights |
aiProcess_RemoveRedundantMaterials |
aiProcess_OptimizeMeshes);

aiMesh** meshes = scene->mMeshes;

UINT numVertices = 0;
UINT numFaces = 0;
UINT inx_vertex = 0;
UINT inx_faces = 0;
UINT startIndex = 0;

for(int nMeshes = 0; nMeshes < scene->mNumMeshes; nMeshes++)
{
numVertices += meshes[nMeshes]->mNumVertices;
numFaces += meshes[nMeshes]->mNumFaces;
}

VERTEX::PositionNormalColor *vertices = new VERTEX::PositionNormalColor[numVertices];
USHORT *indices = new USHORT[numFaces*3];

for(int nMeshes = 0; nMeshes < scene->mNumMeshes; nMeshes++)
{
startIndex = inx_vertex;

for(int nVertex = 0; nVertex < meshes[nMeshes]->mNumVertices; nVertex++)
{
vertices[inx_vertex].X = meshes[nMeshes]->mVertices[nVertex].x;
vertices[inx_vertex].Y = meshes[nMeshes]->mVertices[nVertex].y;
vertices[inx_vertex].Z = meshes[nMeshes]->mVertices[nVertex].z;
vertices[inx_vertex].Nx = meshes[nMeshes]->mNormals[nVertex].x;
vertices[inx_vertex].Ny = meshes[nMeshes]->mNormals[nVertex].y;
vertices[inx_vertex].Nz = meshes[nMeshes]->mNormals[nVertex].z;
vertices[inx_vertex].Color = D3DCOLOR_XRGB(255,255,255);

inx_vertex++;
}

for(int nFaces = 0; nFaces < meshes[nMeshes]->mNumFaces; nFaces++)
{
indices[inx_faces++] = meshes[nMeshes]->mFaces[nFaces].mIndices[0] + startIndex;
indices[inx_faces++] = meshes[nMeshes]->mFaces[nFaces].mIndices[1] + startIndex;
indices[inx_faces++] = meshes[nMeshes]->mFaces[nFaces].mIndices[2] + startIndex;
}
}

model->CreateModel(pDevice, numVertices, vertices);
model->SetIndices(pDevice, numFaces*3, indices);


someone can help me???

Thanks!

Share this post


Link to post
Share on other sites
Advertisement
I think it's problem with importer, I have same issues.

Share this post


Link to post
Share on other sites
Hi Ripiz,

Well, I have noticed that the nmbers of the vertices and faces are differents with respect to the viewer and if I modify the flags for the importer this numbers changes.

I don't understand this. :blink:

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement