Jump to content

bad indices message


photo

Recommended Posts

Hello.

Object is very simple. 

But "bad indices message" printed.

What's wrong in this code.?

            MemoryProcessor memory_processor;
            ImportScenePtr scene = importer->getScene();
            int num_meshes = scene->getNumMeshes();
            for (int i = 0; i < num_meshes; ++i)
            {
                MeshPtr m = Mesh::create();
                importer->importMesh(memory_processor.getImportProcessor(), m, scene->getMesh(i));
                if (m->getNumBones())
                {
                    int num_animations = scene->getNumAnimations();
                    for (int i = 0; i < num_animations; ++i)
                    {
                        MeshPtr animation_mesh = Mesh::create();
                        importer->importAnimation(memory_processor.getImportProcessor(), animation_mesh,
                            scene->getMesh(i), scene->getAnimation(i));
                    }
                }

                int nNumSurface = m->getNumSurfaces();

                for (int idx = 0; idx < nNumSurface; ++idx)
                {
                    int nNumVertex = m->getNumVertex(idx);
                    for (int idxVertex = 0; idxVertex < nNumVertex; ++idxVertex)
                    {
                        Math::vec3 vertex = m->getVertex(idxVertex, idx);
                    }

                    int nNumIndex = m->getNumIndices(idx);
                    for (int idxIndex = 0; idxIndex < nNumIndex; ++idxIndex)
                    {
                        int nIndex = m->getIndex(idxIndex, idx); //Error Message
                    }

                }
            }

INT01660.fbx

Link to comment

HI!
More likely, you got mesh with different T-Index and C-Index, try use getNumCIndices+getCIndex for get indices  for vertex coordinates or getNumTIndices+getTIndex for another mesh data
 

//...
int nNumCIndex = m->getNumCIndices(idx);
for (int idxCIndex = 0; idxIndex < nNumCIndex; ++idxCIndex)
{
    int nCIndex = m->getCIndex(idxCIndex, idx); //Error Message
}
//....

 

Link to comment
×
×
  • Create New...