Commit 7d1cc0c5 authored by andrea ruzzenenti's avatar andrea ruzzenenti

model scale addded + vertex normal bugix

parent da269af9
......@@ -325,6 +325,8 @@ public:
int getTilesCols() const;
void scale(const float& f);
/* FIXME
* Change pointer with smartpointers.
*/
......@@ -414,6 +416,8 @@ private:
void setWireframe(GLenum mode);
void factorize_int(const GLsizei area, const GLsizei width_limit, const GLsizei height_limit, GLsizei& width, GLsizei& height);
float scaleFactor{1};
};
#endif /* SUPERIMPOSECAD_H */
......@@ -94,7 +94,9 @@ Mesh Model::processMesh(aiMesh* mesh, const aiScene* scene)
/* Process vertex positions, normals and texture coordinates. */
vertex.Position = glm::vec3(mesh->mVertices[i].x, mesh->mVertices[i].y, mesh->mVertices[i].z);
vertex.Normal = glm::vec3(mesh->mNormals[i].x, mesh->mNormals[i].y, mesh->mNormals[i].z);
if(mesh->mNormals)
vertex.Normal = glm::vec3(mesh->mNormals[i].x, mesh->mNormals[i].y, mesh->mNormals[i].z);
/* Does the mesh contain texture coordinates? */
if (mesh->mTextureCoords[0])
......
......@@ -445,6 +445,10 @@ SICAD::~SICAD()
std::cout << log_ID_ << "OpenGL resource deallocation completed!" << std::endl;
}
void SICAD::scale(const float &f)
{
scaleFactor = f;
}
bool SICAD::getOglWindowShouldClose()
{
......@@ -514,6 +518,7 @@ bool SICAD::superimpose
model[3][0] = pose[0];
model[3][1] = pose[1];
model[3][2] = pose[2];
model = glm::scale(model, glm::vec3(scaleFactor, scaleFactor, scaleFactor));
auto iter_model = model_obj_.find(pair.first);
if (iter_model != model_obj_.end())
......@@ -637,6 +642,7 @@ bool SICAD::superimpose
model[3][0] = static_cast<float>(pose[0]);
model[3][1] = static_cast<float>(pose[1]);
model[3][2] = static_cast<float>(pose[2]);
model = glm::scale(model, glm::vec3(scaleFactor, scaleFactor, scaleFactor));
auto iter_model = model_obj_.find(pair.first);
if (iter_model != model_obj_.end())
......@@ -796,6 +802,7 @@ bool SICAD::superimpose
model[3][0] = pose[0];
model[3][1] = pose[1];
model[3][2] = pose[2];
model = glm::scale(model, glm::vec3(scaleFactor, scaleFactor, scaleFactor));
auto iter_model = model_obj_.find(pair.first);
if (iter_model != model_obj_.end())
......@@ -908,6 +915,7 @@ bool SICAD::superimpose
model[3][0] = pose[0];
model[3][1] = pose[1];
model[3][2] = pose[2];
model = glm::scale(model, glm::vec3(scaleFactor, scaleFactor, scaleFactor));
auto iter_model = model_obj_.find(pair.first);
if (iter_model != model_obj_.end())
......@@ -1026,6 +1034,7 @@ bool SICAD::superimpose
model[3][0] = static_cast<float>(pose[0]);
model[3][1] = static_cast<float>(pose[1]);
model[3][2] = static_cast<float>(pose[2]);
model = glm::scale(model, glm::vec3(scaleFactor, scaleFactor, scaleFactor));
auto iter_model = model_obj_.find(pair.first);
if (iter_model != model_obj_.end())
......@@ -1151,6 +1160,7 @@ bool SICAD::superimpose
model[3][0] = static_cast<float>(pose[0]);
model[3][1] = static_cast<float>(pose[1]);
model[3][2] = static_cast<float>(pose[2]);
model = glm::scale(model, glm::vec3(scaleFactor, scaleFactor, scaleFactor));
auto iter_model = model_obj_.find(pair.first);
if (iter_model != model_obj_.end())
......
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