Commit 9b3d12df authored by Anakin's avatar Anakin
Browse files

scale everything to 1,

cloth not displayed completely,
corvette is not displayed why?
parent a47eefe9
...@@ -81,7 +81,7 @@ private: ...@@ -81,7 +81,7 @@ private:
float fRotationZ = 0; float fRotationZ = 0;
double dTranslationX = 0; double dTranslationX = 0;
double dTranslationY = 0; double dTranslationY = 0;
double dTranslationZ = 5; double dTranslationZ = 3;
// ======================================== // ========================================
......
...@@ -243,13 +243,19 @@ glm::mat4 OpenGLController::getMVPMatrix(unsigned int index) ...@@ -243,13 +243,19 @@ glm::mat4 OpenGLController::getMVPMatrix(unsigned int index)
m4x4ModelRot = glm::rotate(m4x4ModelRot, fRotationY, glm::vec3(0, 1, 0)); m4x4ModelRot = glm::rotate(m4x4ModelRot, fRotationY, glm::vec3(0, 1, 0));
m4x4ModelRot = glm::rotate(m4x4ModelRot, fRotationZ, glm::vec3(0, 0, 1)); m4x4ModelRot = glm::rotate(m4x4ModelRot, fRotationZ, glm::vec3(0, 0, 1));
// move to center
glm::mat4 m4x4ModelCenter = glm::translate( glm::mat4 m4x4ModelCenter = glm::translate(
glm::mat4(1.0f), glm::mat4(1.0f),
glm::vec3(-sceneBoundingBox.center[0], -sceneBoundingBox.center[1], -sceneBoundingBox.center[2]) glm::vec3(-sceneBoundingBox.center[0], -sceneBoundingBox.center[1], -sceneBoundingBox.center[2])
); );
//scale to 1
float maxExtent = max(max(sceneBoundingBox.extents[0], sceneBoundingBox.extents[1]), sceneBoundingBox.extents[2]);
glm::mat4 m4x4Normalize = glm::mat4(1.0f);
m4x4Normalize = glm::scale(m4x4Normalize, glm::vec3(1/maxExtent, 1 / maxExtent, 1 / maxExtent));
// Return MVP // Return MVP
return m4x4Projection * m4x4View * m4x4ModelRot * m4x4ModelCenter * getModelMatrix(index); return m4x4Projection * m4x4View * m4x4ModelRot * m4x4Normalize * m4x4ModelCenter * getModelMatrix(index);
} }
......
...@@ -17,7 +17,7 @@ int main(int argc, char** argv) ...@@ -17,7 +17,7 @@ int main(int argc, char** argv)
else else
scene = OpenGLController::getInstance(); scene = OpenGLController::getInstance();
scene->loadMsh("..\\Release\\Msh\\multiModTex.msh"); scene->loadMsh("..\\Release\\Msh\\quadPoly.msh");
do { do {
scene->updateScene(); scene->updateScene();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment