Model is now transformable
This commit is contained in:
parent
8c62929e3c
commit
9a40f89fe8
|
@ -131,7 +131,7 @@ int main(int argc, char** argv)
|
|||
flashlight.linear = 0.022f;
|
||||
flashlight.quadratic = 0.0019f;
|
||||
flashlight.angle = 18.0f;
|
||||
flashlight.outerAngle = 25.0f;
|
||||
flashlight.outerAngle = 24.9f;
|
||||
|
||||
while (!glfwWindowShouldClose(window))
|
||||
{
|
||||
|
@ -143,6 +143,8 @@ int main(int argc, char** argv)
|
|||
|
||||
shader->Use();
|
||||
|
||||
shader->SetUniformMatrix3fv("normal", 1, GL_FALSE, glm::value_ptr(model.GetNormalMatrix()));
|
||||
shader->SetUniformMatrix4fv("model", 1, GL_FALSE, glm::value_ptr(model.GetMatrix()));
|
||||
shader->SetUniformMatrix4fv("view", 1, GL_FALSE, glm::value_ptr(camera.GetMatrix()));
|
||||
shader->SetUniformMatrix4fv("projection", 1, GL_FALSE, glm::value_ptr(camera.GetProjection()));
|
||||
|
||||
|
@ -155,6 +157,8 @@ int main(int argc, char** argv)
|
|||
shader->SetUniform("flashlight.quadratic", flashlight.quadratic);
|
||||
|
||||
model.Render(shader);
|
||||
|
||||
model.Rotate(1.0f, glm::vec3(0.0f, 1.0f, 0.0f));
|
||||
|
||||
glfwSwapBuffers(window);
|
||||
glfwPollEvents();
|
||||
|
|
|
@ -8,14 +8,16 @@ out vec3 oNormal;
|
|||
out vec2 oUV;
|
||||
out vec3 oFragPos;
|
||||
|
||||
uniform mat3 normal;
|
||||
uniform mat4 model;
|
||||
uniform mat4 view;
|
||||
uniform mat4 projection;
|
||||
|
||||
void main()
|
||||
{
|
||||
oNormal = aNormal;
|
||||
oNormal = normal * aNormal;
|
||||
oUV = aUV;
|
||||
|
||||
gl_Position = projection * view * vec4(aPos, 1.0);
|
||||
oFragPos = aPos;
|
||||
gl_Position = projection * view * model * vec4(aPos, 1.0);
|
||||
oFragPos = vec3(model * vec4(aPos, 1.0));
|
||||
}
|
|
@ -5,13 +5,14 @@
|
|||
|
||||
#include <core.hpp>
|
||||
#include <shader.hpp>
|
||||
#include <object.hpp>
|
||||
#include <model/mesh.hpp>
|
||||
|
||||
#include <assimp/scene.h>
|
||||
|
||||
namespace oglu
|
||||
{
|
||||
class OGLU_API Model
|
||||
class OGLU_API Model : public Transformable
|
||||
{
|
||||
public:
|
||||
Model(const std::string& path);
|
||||
|
|
Loading…
Reference in a new issue