Bugfix : pcGroupTris isn't really const, removed const and const_cast ( merged from GitHub, thanks to Riku Palomäki ).

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1216 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
pull/5/head
kimmi 2012-03-20 20:42:16 +00:00
parent f8deb8ff83
commit cb71e6f5f2
2 changed files with 6 additions and 6 deletions

View File

@ -846,7 +846,7 @@ struct IntGroupInfo_MDL7
BE_NCONST MDL::TexCoord_MDL7* pcGroupUVs; BE_NCONST MDL::TexCoord_MDL7* pcGroupUVs;
//! Points to the beginning of the triangle section //! Points to the beginning of the triangle section
BE_NCONST MDL::Triangle_MDL7* pcGroupTris; MDL::Triangle_MDL7* pcGroupTris;
//! Points to the beginning of the vertex section //! Points to the beginning of the vertex section
BE_NCONST MDL::Vertex_MDL7* pcGroupVerts; BE_NCONST MDL::Vertex_MDL7* pcGroupVerts;

View File

@ -191,7 +191,7 @@ void MDLImporter::InternReadFile( const std::string& pFile,
iGSFileVersion = 7; iGSFileVersion = 7;
InternReadFile_3DGS_MDL7(); InternReadFile_3DGS_MDL7();
} }
// IDST/IDSQ Format (CS:S/HL², etc ...) // IDST/IDSQ Format (CS:S/HL^2, etc ...)
else if (AI_MDL_MAGIC_NUMBER_BE_HL2a == iMagicWord || AI_MDL_MAGIC_NUMBER_LE_HL2a == iMagicWord || else if (AI_MDL_MAGIC_NUMBER_BE_HL2a == iMagicWord || AI_MDL_MAGIC_NUMBER_LE_HL2a == iMagicWord ||
AI_MDL_MAGIC_NUMBER_BE_HL2b == iMagicWord || AI_MDL_MAGIC_NUMBER_LE_HL2b == iMagicWord) AI_MDL_MAGIC_NUMBER_BE_HL2b == iMagicWord || AI_MDL_MAGIC_NUMBER_LE_HL2b == iMagicWord)
{ {
@ -970,7 +970,7 @@ void MDLImporter::ReadFaces_3DGS_MDL7(const MDL::IntGroupInfo_MDL7& groupInfo,
MDL::IntGroupData_MDL7& groupData) MDL::IntGroupData_MDL7& groupData)
{ {
const MDL::Header_MDL7 *pcHeader = (const MDL::Header_MDL7*)this->mBuffer; const MDL::Header_MDL7 *pcHeader = (const MDL::Header_MDL7*)this->mBuffer;
BE_NCONST MDL::Triangle_MDL7* pcGroupTris = groupInfo.pcGroupTris; MDL::Triangle_MDL7* pcGroupTris = groupInfo.pcGroupTris;
// iterate through all triangles and build valid display lists // iterate through all triangles and build valid display lists
unsigned int iOutIndex = 0; unsigned int iOutIndex = 0;
@ -986,7 +986,7 @@ void MDLImporter::ReadFaces_3DGS_MDL7(const MDL::IntGroupInfo_MDL7& groupInfo,
unsigned int iIndex = pcGroupTris->v_index[c]; unsigned int iIndex = pcGroupTris->v_index[c];
if(iIndex > (unsigned int)groupInfo.pcGroup->numverts) { if(iIndex > (unsigned int)groupInfo.pcGroup->numverts) {
// (we might need to read this section a second time - to process frame vertices correctly) // (we might need to read this section a second time - to process frame vertices correctly)
const_cast<MDL::Triangle_MDL7*>(pcGroupTris)->v_index[c] = iIndex = groupInfo.pcGroup->numverts-1; pcGroupTris->v_index[c] = iIndex = groupInfo.pcGroup->numverts-1;
DefaultLogger::get()->warn("Index overflow in MDL7 vertex list"); DefaultLogger::get()->warn("Index overflow in MDL7 vertex list");
} }
@ -1083,7 +1083,7 @@ void MDLImporter::ReadFaces_3DGS_MDL7(const MDL::IntGroupInfo_MDL7& groupInfo,
} }
} }
// get the next triangle in the list // get the next triangle in the list
pcGroupTris = (BE_NCONST MDL::Triangle_MDL7*)((const char*)pcGroupTris + pcHeader->triangle_stc_size); pcGroupTris = (MDL::Triangle_MDL7*)((const char*)pcGroupTris + pcHeader->triangle_stc_size);
} }
} }
@ -1422,7 +1422,7 @@ void MDLImporter::InternReadFile_3DGS_MDL7( )
szCurrent += pcHeader->skinpoint_stc_size * groupInfo.pcGroup->num_stpts; szCurrent += pcHeader->skinpoint_stc_size * groupInfo.pcGroup->num_stpts;
// now get a pointer to all triangle in the group // now get a pointer to all triangle in the group
groupInfo.pcGroupTris = (BE_NCONST MDL::Triangle_MDL7*)szCurrent; groupInfo.pcGroupTris = (Triangle_MDL7*)szCurrent;
szCurrent += pcHeader->triangle_stc_size * groupInfo.pcGroup->numtris; szCurrent += pcHeader->triangle_stc_size * groupInfo.pcGroup->numtris;
// now get a pointer to all vertices in the group // now get a pointer to all vertices in the group