1 #include "MasterState.hpp"
3 #include "../world/Body.hpp"
4 #include "../world/Simulation.hpp"
6 #include <glm/gtx/transform.hpp>
12 MasterState::MasterState(Assets &assets, world::Simulation &sim) noexcept
16 , reference(&sim.Root())
20 cam.View(glm::translate(glm::vec3(-3.0f, -2.0f, -10.0f)));
23 MasterState::~MasterState() noexcept {
27 void MasterState::OnResize(int w, int h) {
28 cam.Aspect(float(w), float(h));
31 void MasterState::OnUpdate(int dt) {
33 while (remain >= FrameMS()) {
38 void MasterState::Tick() {
41 thirds = (thirds + 1) % 3;
44 int MasterState::FrameMS() const noexcept {
45 return thirds == 0 ? 16 : 17;
49 void MasterState::OnRender(graphics::Viewport &viewport) {
50 assets.shaders.planet_surface.Activate();
51 assets.shaders.planet_surface.SetMVP(glm::mat4(1.0f), cam.View(), cam.Projection());
52 assets.shaders.planet_surface.SetTexture(assets.textures.tiles);
53 reference->Draw(assets, viewport);