From c747968b910c7769a2f689d8a59e0dd46de6f9d4 Mon Sep 17 00:00:00 2001 From: Faerbit Date: Thu, 23 Oct 2014 00:53:00 +0200 Subject: [PATCH] Chaging object implementation to new shader class. --- object.cc | 10 +++------- object.hh | 4 ++-- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/object.cc b/object.cc index abd5cfd..7782e38 100644 --- a/object.cc +++ b/object.cc @@ -1,17 +1,13 @@ #include "object.hh" Object::Object(Model model, Texture texture, glm::vec3 position, glm::vec3 rotation, - glm::vec3 velocity, glm::vec3 angularVelocity) : Entity(position, rotation) { + glm::vec3 velocity, glm::vec3 angularVelocity, Shader shader) : + Entity(position, rotation) { this->model = model.getReference(); this->texture = texture.getReference(); this->velocity = velocity; this->angularVelocity = angularVelocity; - - //TODO ensure this is only done once per loading(static encapsulation) - - shader = ACGL::OpenGL::ShaderProgramCreator("HelloWorld").attributeLocations( - model.getReference()->getAttributeLocations()).create(); - shader->use(); + this->shader = shader.getReference(); } Object::~Object() { diff --git a/object.hh b/object.hh index 95f003c..b698c69 100644 --- a/object.hh +++ b/object.hh @@ -4,16 +4,16 @@ #include "entity.hh" #include "model.hh" #include "texture.hh" +#include "shader.hh" #include #include #include #include -#include class Object : Entity { public: Object(Model model, Texture texture, glm::vec3 position, glm::vec3 rotation, - glm::vec3 velocity, glm::vec3 angularVelocity); + glm::vec3 velocity, glm::vec3 angularVelocity, Shader shader); ~Object(); void render(); private: