Skip to content
Snippets Groups Projects
Commit fc7941a8 authored by Anakin's avatar Anakin
Browse files

fixed rotation problem

parent 24d26cfd
No related branches found
No related tags found
No related merge requests found
......@@ -30,6 +30,7 @@ struct Model {
std::string name = "";
std::string parent = "";
QMatrix4x4 m4x4Translation;
QQuaternion quadRotation;
std::vector<Segment*> segmList;
};
......
......@@ -59,6 +59,7 @@ void GeometryEngine::loadFile(const char* filePath)
new_info.size = segmentIterator->indices.size();
new_info.textureIndex = segmentIterator->textureIndex;
new_info.modelMatrix = modelIterator->m4x4Translation;
new_info.modelMatrix.rotate(modelIterator->quadRotation);
// add offset to indices
for (auto& it : segmentIterator->indices)
......
......@@ -293,8 +293,9 @@ void MshFile::analyseModlChunks(Model * dataDestination, std::list<ChunkHeader*>
// modify the matrix
dataDestination->m4x4Translation.scale(tmp_scale[0], tmp_scale[1], tmp_scale[2]);
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->quadRotation.setVector(QVector3D(tmp_rotation[0], tmp_rotation[1], tmp_rotation[2]));
dataDestination->quadRotation.setScalar(tmp_rotation[3]);
dataDestination->m4x4Translation = getParentMatrix(dataDestination->parent) * dataDestination->m4x4Translation;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment