-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplatform.cpp
More file actions
36 lines (29 loc) · 781 Bytes
/
Copy pathplatform.cpp
File metadata and controls
36 lines (29 loc) · 781 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "platform.h"
#include <GLFW/glfw3.h>
#include "effolkronium/random.hpp"
Platform::Platform(const Model& model, const Shader& shader, const glm::vec3& position, const glm::vec3& size, bool oscillate, const glm::vec3& offset, const glm::vec3& scale)
: VisibleObject{model, shader, position, size, offset, scale},
offset_{effolkronium::random_thread_local::get<float>(1, 10)},
oscillate_{oscillate}
{
}
void Platform::init()
{
}
void Platform::tick(float deltaTime)
{
if (oscillate_)
{
const auto y{sin(static_cast<float>(glfwGetTime())) * 0.0025f * offset_ * deltaTime};
addVelocity(glm::vec3{0.0f, y, 0.0f});
move();
}
}
void Platform::setOscillate(bool oscillate)
{
oscillate_ = oscillate;
}
bool Platform::getOscillate() const
{
return oscillate_;
}