2014-10-22 22:13:09 +00:00
|
|
|
#include "object.hh"
|
|
|
|
|
2014-11-08 00:17:23 +00:00
|
|
|
Object::Object(Model model, Material material, glm::vec3 position, glm::vec3 rotation,
|
2014-10-22 22:53:00 +00:00
|
|
|
glm::vec3 velocity, glm::vec3 angularVelocity, Shader shader) :
|
|
|
|
Entity(position, rotation) {
|
2014-10-22 22:13:09 +00:00
|
|
|
this->model = model.getReference();
|
2014-11-08 00:17:23 +00:00
|
|
|
this->material = material;
|
2014-10-22 22:13:09 +00:00
|
|
|
this->velocity = velocity;
|
|
|
|
this->angularVelocity = angularVelocity;
|
2014-10-22 22:53:00 +00:00
|
|
|
this->shader = shader.getReference();
|
2014-10-22 22:13:09 +00:00
|
|
|
}
|
|
|
|
|
2014-10-24 08:48:45 +00:00
|
|
|
Object::Object() {
|
|
|
|
}
|
|
|
|
|
2014-10-22 22:13:09 +00:00
|
|
|
Object::~Object() {
|
|
|
|
}
|
|
|
|
|
|
|
|
void Object::render() {
|
2014-11-08 00:44:24 +00:00
|
|
|
shader->setUniform("ambientFactor", material.getAmbientFactor());
|
|
|
|
shader->setUniform("diffuseFactor", material.getDiffuseFactor());
|
|
|
|
shader->setUniform("specularFactor", material.getSpecularFactor());
|
|
|
|
shader->setUniform("shininess", material.getShininess());
|
2014-11-08 00:17:23 +00:00
|
|
|
shader->setTexture("uTexture", material.getReference(), 0);
|
2014-10-24 08:48:45 +00:00
|
|
|
model->render();
|
2014-10-22 22:13:09 +00:00
|
|
|
}
|