Added a update function to the level which rotates the bunny.
This commit is contained in:
parent
f5a1864472
commit
16f4890458
@ -40,6 +40,9 @@ void deleteCustomResources()
|
|||||||
|
|
||||||
void draw(float runTime)
|
void draw(float runTime)
|
||||||
{
|
{
|
||||||
|
// update Level first TODO: move this with the rest of the stuff that doesn't belong here to main
|
||||||
|
level.update(runTime);
|
||||||
|
|
||||||
// clear the framebuffer:
|
// clear the framebuffer:
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
|
5
level.cc
5
level.cc
@ -41,6 +41,11 @@ void Level::render() {
|
|||||||
this->terrain.render();
|
this->terrain.render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Level::update(float runTime) {
|
||||||
|
// rotate bunny
|
||||||
|
objects[0].setRotation(glm::vec3(0.0f, 1.0472f * runTime, 0.0f));
|
||||||
|
}
|
||||||
|
|
||||||
glm::vec3 Level::getAmbientLight() {
|
glm::vec3 Level::getAmbientLight() {
|
||||||
return ambientLight;
|
return ambientLight;
|
||||||
}
|
}
|
||||||
|
1
level.hh
1
level.hh
@ -14,6 +14,7 @@ class Level {
|
|||||||
Level();
|
Level();
|
||||||
~Level();
|
~Level();
|
||||||
void load(ACGL::OpenGL::SharedShaderProgram shader); // Shader is necessary for correct texture assigning
|
void load(ACGL::OpenGL::SharedShaderProgram shader); // Shader is necessary for correct texture assigning
|
||||||
|
void update(float runTime);
|
||||||
void render();
|
void render();
|
||||||
glm::vec3 getAmbientLight();
|
glm::vec3 getAmbientLight();
|
||||||
std::vector<Light> getLights();
|
std::vector<Light> getLights();
|
||||||
|
Loading…
Reference in New Issue
Block a user