2020-03-18 22:42:04 +01:00
|
|
|
#include <opengl-playground/openglgraphics.hpp>
|
|
|
|
|
2020-03-21 22:38:10 +01:00
|
|
|
OpenGlGraphics::OpenGlGraphics(std::shared_ptr<OpenGlShaderProgram>shader_prog)
|
2020-03-18 22:42:04 +01:00
|
|
|
{
|
2020-03-21 22:38:10 +01:00
|
|
|
this->shaderprog = shader_prog;
|
|
|
|
this->setModelMatrix(glm::mat4(1.0f));
|
2020-03-18 22:42:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
OpenGlGraphics::~OpenGlGraphics()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2020-03-21 22:38:10 +01:00
|
|
|
|
|
|
|
void OpenGlGraphics::setModelMatrix(const glm::mat4 &model_matrix)
|
|
|
|
{
|
|
|
|
this->model_matrix = model_matrix;
|
2020-03-26 23:03:49 +01:00
|
|
|
this->normal_matrix = glm::mat3(glm::transpose(glm::inverse(model_matrix)));
|
2020-03-21 22:38:10 +01:00
|
|
|
}
|
|
|
|
|
2020-03-26 23:03:49 +01:00
|
|
|
const glm::mat4 &OpenGlGraphics::getModelMatrix()
|
2020-03-21 22:38:10 +01:00
|
|
|
{
|
|
|
|
return this->model_matrix;
|
|
|
|
}
|
2020-03-24 23:13:49 +01:00
|
|
|
|
2020-03-26 23:03:49 +01:00
|
|
|
const glm::mat3 &OpenGlGraphics::getNormalMatrix()
|
2020-03-24 23:13:49 +01:00
|
|
|
{
|
|
|
|
return this->normal_matrix;
|
|
|
|
}
|