fixed rotation problem
This commit is contained in:
parent
24d26cfdfa
commit
fc7941a890
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue