Added phong lighting

This commit is contained in:
Robert 2021-01-27 22:42:47 +01:00
parent 839df891ab
commit 6f46112f14
7 changed files with 90 additions and 11 deletions

View file

@ -52,6 +52,11 @@ namespace oglu
LookAt(this->position + front);
}
const glm::vec3 Camera::GetPosition()
{
return position;
}
void Camera::Move(float x, float y, float z)
{
this->position += glm::vec3(x, y, z);

View file

@ -2,19 +2,19 @@
namespace oglu
{
Object::Object(const GLfloat* vertices, size_t verticesSize, const GLuint* indices, size_t indicesSize, const VertexAttribute* topology, size_t topologySize) //:
// VAO(MakeVertexArray(vertices, verticesSize, indices, indicesSize, topology, topologySize))
Object::Object(const GLfloat* vertices, size_t verticesSize, const GLuint* indices, size_t indicesSize, const VertexAttribute* topology, size_t topologySize) :
VAO(MakeVertexArray(vertices, verticesSize, indices, indicesSize, topology, topologySize)),
material(new Material)
{
VAO = MakeVertexArray(vertices, verticesSize, indices, indicesSize, topology, topologySize);
}
Object::Object(const VertexArray& vao) :
VAO(vao)
VAO(vao), material(new Material)
{
}
Object::Object(const Object& other) :
VAO(other.VAO)
VAO(other.VAO), material(new Material)
{
}
@ -26,4 +26,9 @@ namespace oglu
{
VAO->BindAndDraw();
}
void Object::CopyMaterial(const Material& other)
{
memcpy(material.get(), &other, sizeof(Material));
}
}