Skip to content

Commit

Permalink
Bugfix : pcGroupTris isn't really const, removed const and const_cast…
Browse files Browse the repository at this point in the history
… ( 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
  • Loading branch information
kimmi committed Mar 20, 2012
1 parent f8deb8f commit cb71e6f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion code/MDLFileData.h
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ struct IntGroupInfo_MDL7
BE_NCONST MDL::TexCoord_MDL7* pcGroupUVs;

//! 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
BE_NCONST MDL::Vertex_MDL7* pcGroupVerts;
Expand Down
10 changes: 5 additions & 5 deletions code/MDLLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ void MDLImporter::InternReadFile( const std::string& pFile,
iGSFileVersion = 7;
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 ||
AI_MDL_MAGIC_NUMBER_BE_HL2b == iMagicWord || AI_MDL_MAGIC_NUMBER_LE_HL2b == iMagicWord)
{
Expand Down Expand Up @@ -970,7 +970,7 @@ void MDLImporter::ReadFaces_3DGS_MDL7(const MDL::IntGroupInfo_MDL7& groupInfo,
MDL::IntGroupData_MDL7& groupData)
{
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
unsigned int iOutIndex = 0;
Expand All @@ -986,7 +986,7 @@ void MDLImporter::ReadFaces_3DGS_MDL7(const MDL::IntGroupInfo_MDL7& groupInfo,
unsigned int iIndex = pcGroupTris->v_index[c];
if(iIndex > (unsigned int)groupInfo.pcGroup->numverts) {
// (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");
}

Expand Down Expand Up @@ -1083,7 +1083,7 @@ void MDLImporter::ReadFaces_3DGS_MDL7(const MDL::IntGroupInfo_MDL7& groupInfo,
}
}
// 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);
}
}

Expand Down Expand Up @@ -1422,7 +1422,7 @@ void MDLImporter::InternReadFile_3DGS_MDL7( )
szCurrent += pcHeader->skinpoint_stc_size * groupInfo.pcGroup->num_stpts;

// 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;

// now get a pointer to all vertices in the group
Expand Down

0 comments on commit cb71e6f

Please sign in to comment.