Skip to content

Commit

Permalink
Merge pull request assimp#3742 from Garux/patch-1
Browse files Browse the repository at this point in the history
Fix MDC loader
  • Loading branch information
kimkulling authored Apr 14, 2021
2 parents bbfefd8 + 0b61a88 commit c282b9a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions code/AssetLib/MDC/MDCLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ void MDCImporter::InternReadFile(

// get the number of valid surfaces
BE_NCONST MDC::Surface *pcSurface, *pcSurface2;
pcSurface = pcSurface2 = new (mBuffer + pcHeader->ulOffsetSurfaces) MDC::Surface;
pcSurface = pcSurface2 = reinterpret_cast<BE_NCONST MDC::Surface *>(mBuffer + pcHeader->ulOffsetSurfaces);
unsigned int iNumShaders = 0;
for (unsigned int i = 0; i < pcHeader->ulNumSurfaces; ++i) {
// validate the surface header
Expand All @@ -260,7 +260,7 @@ void MDCImporter::InternReadFile(
++pScene->mNumMeshes;
}
iNumShaders += pcSurface2->ulNumShaders;
pcSurface2 = new ((int8_t *)pcSurface2 + pcSurface2->ulOffsetEnd) MDC::Surface;
pcSurface2 = reinterpret_cast<BE_NCONST MDC::Surface *>((BE_NCONST int8_t *)pcSurface2 + pcSurface2->ulOffsetEnd);
}
aszShaders.reserve(iNumShaders);
pScene->mMeshes = new aiMesh *[pScene->mNumMeshes];
Expand Down Expand Up @@ -405,7 +405,7 @@ void MDCImporter::InternReadFile(
pcFaceCur->mIndices[2] = iOutIndex + 0;
}

pcSurface = new ((int8_t *)pcSurface + pcSurface->ulOffsetEnd) MDC::Surface;
pcSurface = reinterpret_cast<BE_NCONST MDC::Surface *>((BE_NCONST int8_t *)pcSurface + pcSurface->ulOffsetEnd);
}

// create a flat node graph with a root node and one child for each surface
Expand Down

0 comments on commit c282b9a

Please sign in to comment.