, cam_orient(PI * 0.375, PI * 0.25, 0.0)
, cam_dragging(false)
, cp(assets)
+, rp(sim)
+, tp(sim)
, remain(0)
, thirds(0)
, paused(false) {
void MasterState::OnUpdate(int dt) {
remain += dt;
- while (remain >= FrameMS()) {
+#ifdef NDEBUG
+ int max_tick = 10;
+#else
+ // one tick per frame when debugging so pausing execution doesn't result in more ticks
+ int max_tick = 1;
+#endif
+ while (remain >= FrameMS() && max_tick > 0) {
Tick();
+ --max_tick;
}
}
constexpr double pitch_scale = PI * 0.001;
constexpr double yaw_scale = PI * 0.002;
if (cam_dragging) {
- cam_orient.x = glm::clamp(cam_orient.x + double(e.yrel) * pitch_scale, 0.0, PI * 0.5);
+ cam_orient.x = glm::clamp(cam_orient.x + double(e.yrel) * pitch_scale, 0.0, PI * 0.499);
cam_orient.y = std::fmod(cam_orient.y + double(e.xrel) * yaw_scale, PI * 2.0);
}
}
// TODO: extend to nearby bodies as well
for (auto c : cam.Reference().Creatures()) {
assets.shaders.creature_skin.SetM(cam.Model(cam.Reference()) * glm::mat4(c->LocalTransform()));
- assets.shaders.creature_skin.SetBaseColor(c->BaseColor());
- assets.shaders.creature_skin.SetHighlightColor(c->HighlightColor());
+ assets.shaders.creature_skin.SetBaseColor(glm::vec3(c->BaseColor()));
+ assets.shaders.creature_skin.SetHighlightColor(glm::vec4(c->HighlightColor()));
c->Draw(viewport);
}
viewport.ClearDepth();
- cp.Draw(assets, viewport);
+ cp.Draw(viewport);
+ rp.Draw(viewport);
+ tp.Draw(viewport);
}
}