hello. I'm trying to implement 3DS models loader and found a tut to help me. And i found piece of code wich i cannot understand. Like title says it's about pointers. I think that that code is incorrect but compiler gives me no errors...
Thanks in advanceCode://I have these structures typedef struct tagFACE { unsigned int a, b, c; int MaterialID; }stFace; struct stMesh { ... stFace* pFace; ... stMesh() { ... pFace = NULL; ... } }; struct stObject { int MeshsNum, MaterialsNum; std::vector<stMesh> pMeshs; std::vector<stMaterial> pMaterials; stObject() { MeshsNum = MaterialsNum = 0; } }; //And i found this cycle stMesh *pMesh = &(pObject->pMeshs[pObject->MeshsNum-1]); for(int i=0; i<FacesNum; i++) { pMesh->pFace[Index].MaterialID = MaterialID; /*I cannot understand how this index can be okay?*/ }




Reply With Quote