closes https://github.com/assimp/assimp/issues/1721: set camera parameters instead of nonsense.

This commit is contained in:
Kim Kulling
2018-01-24 21:20:34 +01:00
parent b43923a759
commit 0b15d5cd46
6 changed files with 41 additions and 55 deletions

View File

@@ -340,9 +340,9 @@ void FlipQuakeHeader(BE_NCONST MDL::Header* pcHeader)
// ------------------------------------------------------------------------------------------------
// Read a Quake 1 file
void MDLImporter::InternReadFile_Quake1( )
{
void MDLImporter::InternReadFile_Quake1() {
ai_assert(NULL != pScene);
BE_NCONST MDL::Header *pcHeader = (BE_NCONST MDL::Header*)this->mBuffer;
#ifdef AI_BUILD_BIG_ENDIAN
@@ -355,9 +355,11 @@ void MDLImporter::InternReadFile_Quake1( )
const unsigned char* szCurrent = (const unsigned char*)(pcHeader+1);
// need to read all textures
for (unsigned int i = 0; i < (unsigned int)pcHeader->num_skins;++i)
{
union{BE_NCONST MDL::Skin* pcSkin;BE_NCONST MDL::GroupSkin* pcGroupSkin;};
for ( unsigned int i = 0; i < (unsigned int)pcHeader->num_skins; ++i) {
union {
BE_NCONST MDL::Skin* pcSkin;
BE_NCONST MDL::GroupSkin* pcGroupSkin;
};
if (szCurrent + sizeof(MDL::Skin) > this->mBuffer + this->iFileSize) {
throw DeadlyImportError("[Quake 1 MDL] Unexpected EOF");
}
@@ -365,17 +367,15 @@ void MDLImporter::InternReadFile_Quake1( )
AI_SWAP4( pcSkin->group );
// Quake 1 groupskins
if (1 == pcSkin->group)
{
// Quake 1 group-skins
if (1 == pcSkin->group) {
AI_SWAP4( pcGroupSkin->nb );
// need to skip multiple images
const unsigned int iNumImages = (unsigned int)pcGroupSkin->nb;
szCurrent += sizeof(uint32_t) * 2;
if (0 != iNumImages)
{
if (0 != iNumImages) {
if (!i) {
// however, create only one output image (the first)
this->CreateTextureARGB8_3DGS_MDL3(szCurrent + iNumImages * sizeof(float));
@@ -384,10 +384,7 @@ void MDLImporter::InternReadFile_Quake1( )
szCurrent += pcHeader->skinheight * pcHeader->skinwidth +
sizeof(float) * iNumImages;
}
}
// 3DGS has a few files that are using other 3DGS like texture formats here
else
{
} else {
szCurrent += sizeof(uint32_t);
unsigned int iSkip = i ? UINT_MAX : 0;
CreateTexture_3DGS_MDL4(szCurrent,pcSkin->group,&iSkip);
@@ -407,17 +404,14 @@ void MDLImporter::InternReadFile_Quake1( )
BE_NCONST MDL::Frame* pcFrames = (BE_NCONST MDL::Frame*)szCurrent;
BE_NCONST MDL::SimpleFrame* pcFirstFrame;
if (0 == pcFrames->type)
{
if (0 == pcFrames->type) {
// get address of single frame
pcFirstFrame = &pcFrames->frame;
}
else
{
} else {
// get the first frame in the group
#if 1
// FIXME: the cast is wrong and causea a warning on clang 5.0
// FIXME: the cast is wrong and cause a warning on clang 5.0
// disable thi code for now, fix it later
ai_assert(false && "Bad pointer cast");
#else