opengl-playground/src/openglgraphics.cpp

29 lines
600 B
C++

#include <opengl-playground/openglgraphics.hpp>
OpenGlGraphics::OpenGlGraphics(std::shared_ptr<OpenGlShaderProgram>shader_prog)
{
this->shaderprog = shader_prog;
this->setModelMatrix(glm::mat4(1.0f));
}
OpenGlGraphics::~OpenGlGraphics()
{
}
void OpenGlGraphics::setModelMatrix(const glm::mat4 &model_matrix)
{
this->model_matrix = model_matrix;
this->normal_matrix = glm::mat3(glm::transpose(glm::inverse(model_matrix)));
}
const glm::mat4 &OpenGlGraphics::getModelMatrix()
{
return this->model_matrix;
}
const glm::mat3 &OpenGlGraphics::getNormalMatrix()
{
return this->normal_matrix;
}