Chaging object implementation to new shader class.

This commit is contained in:
Faerbit 2014-10-23 00:53:00 +02:00
parent 1d924bd2b0
commit c747968b91
2 changed files with 5 additions and 9 deletions

View File

@ -1,17 +1,13 @@
#include "object.hh" #include "object.hh"
Object::Object(Model model, Texture texture, glm::vec3 position, glm::vec3 rotation, 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->model = model.getReference();
this->texture = texture.getReference(); this->texture = texture.getReference();
this->velocity = velocity; this->velocity = velocity;
this->angularVelocity = angularVelocity; this->angularVelocity = angularVelocity;
this->shader = shader.getReference();
//TODO ensure this is only done once per loading(static encapsulation)
shader = ACGL::OpenGL::ShaderProgramCreator("HelloWorld").attributeLocations(
model.getReference()->getAttributeLocations()).create();
shader->use();
} }
Object::~Object() { Object::~Object() {

View File

@ -4,16 +4,16 @@
#include "entity.hh" #include "entity.hh"
#include "model.hh" #include "model.hh"
#include "texture.hh" #include "texture.hh"
#include "shader.hh"
#include <string> #include <string>
#include <ACGL/Math/Math.hh> #include <ACGL/Math/Math.hh>
#include <ACGL/OpenGL/Managers.hh> #include <ACGL/OpenGL/Managers.hh>
#include <ACGL/OpenGL/Objects.hh> #include <ACGL/OpenGL/Objects.hh>
#include <ACGL/OpenGL/Creator/ShaderProgramCreator.hh>
class Object : Entity { class Object : Entity {
public: public:
Object(Model model, Texture texture, glm::vec3 position, glm::vec3 rotation, 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(); ~Object();
void render(); void render();
private: private: