scale everything to 1,
cloth not displayed completely, corvette is not displayed why?
This commit is contained in:
parent
a47eefe92e
commit
9b3d12dfeb
@ -81,7 +81,7 @@ private:
|
||||
float fRotationZ = 0;
|
||||
double dTranslationX = 0;
|
||||
double dTranslationY = 0;
|
||||
double dTranslationZ = 5;
|
||||
double dTranslationZ = 3;
|
||||
|
||||
// ========================================
|
||||
|
||||
|
@ -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, fRotationZ, glm::vec3(0, 0, 1));
|
||||
|
||||
// move to center
|
||||
glm::mat4 m4x4ModelCenter = glm::translate(
|
||||
glm::mat4(1.0f),
|
||||
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 m4x4Projection * m4x4View * m4x4ModelRot * m4x4ModelCenter * getModelMatrix(index);
|
||||
return m4x4Projection * m4x4View * m4x4ModelRot * m4x4Normalize * m4x4ModelCenter * getModelMatrix(index);
|
||||
}
|
||||
|
||||
|
||||
|
@ -17,7 +17,7 @@ int main(int argc, char** argv)
|
||||
else
|
||||
scene = OpenGLController::getInstance();
|
||||
|
||||
scene->loadMsh("..\\Release\\Msh\\multiModTex.msh");
|
||||
scene->loadMsh("..\\Release\\Msh\\quadPoly.msh");
|
||||
|
||||
do {
|
||||
scene->updateScene();
|
||||
|
Loading…
Reference in New Issue
Block a user