fixed crash
This commit is contained in:
@@ -17,6 +17,7 @@ MshFile::MshFile(const char * path)
|
||||
|
||||
MshFile::~MshFile()
|
||||
{
|
||||
//TODO: clean up
|
||||
}
|
||||
|
||||
|
||||
@@ -294,6 +295,8 @@ void MshFile::analyseModlChunks(Model * dataDestination, std::list<ChunkHeader*>
|
||||
dataDestination->m4x4Translation.rotate(QQuaternion(tmp_rotation[3], tmp_rotation[0], tmp_rotation[1], tmp_rotation[2]));
|
||||
dataDestination->m4x4Translation.translate(tmp_trans[0], tmp_trans[1], tmp_trans[2]);
|
||||
|
||||
dataDestination->m4x4Translation = getParentMatrix(dataDestination->parent) * dataDestination->m4x4Translation;
|
||||
|
||||
}
|
||||
|
||||
// geometry data
|
||||
@@ -604,4 +607,21 @@ void MshFile::readUV(Segment * dataDestination, std::streampos position)
|
||||
for (unsigned int j = 0; j < 2; j++)
|
||||
m_file.read(F2V(dataDestination->vertices[i].texCoord[j]), sizeof(float));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QMatrix4x4 MshFile::getParentMatrix(std::string parent) const
|
||||
{
|
||||
QMatrix4x4 matrix;
|
||||
|
||||
for (auto& it : *m_models)
|
||||
{
|
||||
if (!strcmp(parent.c_str(), it->name.c_str()))
|
||||
{
|
||||
//TODO: the other way around??
|
||||
matrix = getParentMatrix(it->parent) * it->m4x4Translation;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return matrix;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user