Implemented object.cc
This commit is contained in:
parent
2d3a17b6c0
commit
606533b74b
22
object.cc
Normal file
22
object.cc
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#include "object.hh"
|
||||||
|
|
||||||
|
Object::Object(Model model, Texture texture, glm::vec3 position, glm::vec3 rotation,
|
||||||
|
glm::vec3 velocity, glm::vec3 angularVelocity) : 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();
|
||||||
|
}
|
||||||
|
|
||||||
|
Object::~Object() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void Object::render() {
|
||||||
|
shader->setTexture("uTexture", texture, 0);
|
||||||
|
}
|
13
object.hh
13
object.hh
@ -4,17 +4,24 @@
|
|||||||
#include "entity.hh"
|
#include "entity.hh"
|
||||||
#include "model.hh"
|
#include "model.hh"
|
||||||
#include "texture.hh"
|
#include "texture.hh"
|
||||||
|
#include <string>
|
||||||
#include <ACGL/Math/Math.hh>
|
#include <ACGL/Math/Math.hh>
|
||||||
|
#include <ACGL/OpenGL/Managers.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, glm::vec3 velocity, glm::vec3 angularVelocity);
|
Object(Model model, Texture texture, glm::vec3 position, glm::vec3 rotation,
|
||||||
|
glm::vec3 velocity, glm::vec3 angularVelocity);
|
||||||
~Object();
|
~Object();
|
||||||
|
void render();
|
||||||
private:
|
private:
|
||||||
Model model;
|
ACGL::OpenGL::SharedVertexArrayObject model;
|
||||||
Texture texture;
|
ACGL::OpenGL::SharedTexture2D texture;
|
||||||
glm::vec3 velocity;
|
glm::vec3 velocity;
|
||||||
glm::vec3 angularVelocity;
|
glm::vec3 angularVelocity;
|
||||||
|
ACGL::OpenGL::SharedShaderProgram shader;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user