X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fapp%2Fstates.cpp;h=b1a20db92a50740934dfac6849065940c84e4ab6;hb=2ab70a92ae39cebc6166ef15545ebcbd31a31c38;hp=862d4184e60238331aa36e3ffd6dae2cf791c0c4;hpb=76b630bd0a147bf7c78d3380237c86b9bfc48530;p=blobs.git diff --git a/src/app/states.cpp b/src/app/states.cpp index 862d418..b1a20db 100644 --- a/src/app/states.cpp +++ b/src/app/states.cpp @@ -29,8 +29,8 @@ MasterState::~MasterState() noexcept { void MasterState::OnResize(int w, int h) { - assets.shaders.plain_color.Activate(); - assets.shaders.plain_color.SetVP(glm::mat4(1.0f), glm::ortho(0.0f, float(w), float(h), 0.0f, 1.0e4f, -1.0e4f)); + assets.shaders.canvas.Activate(); + assets.shaders.canvas.Resize(float(w), float(h)); assets.shaders.alpha_sprite.Activate(); assets.shaders.alpha_sprite.SetVP(glm::mat4(1.0f), glm::ortho(0.0f, float(w), float(h), 0.0f, 1.0e4f, -1.0e4f)); @@ -70,6 +70,16 @@ void MasterState::OnKeyDown(const SDL_KeyboardEvent &e) { } void MasterState::OnRender(graphics::Viewport &viewport) { + if (cp.Shown()) { + cam.TopDown(cp.GetCreature(), 10.0f); + assets.shaders.planet_surface.Activate(); + assets.shaders.planet_surface.SetV(cam.View()); + assets.shaders.sun_surface.Activate(); + assets.shaders.sun_surface.SetV(cam.View()); + assets.shaders.creature_skin.Activate(); + assets.shaders.creature_skin.SetV(cam.View()); + } + int num_lights = 0; for (auto sun : sim.Suns()) { // TODO: source sun's light color and strength @@ -124,8 +134,10 @@ void MasterState::OnRender(graphics::Viewport &viewport) { assets.shaders.creature_skin.SetTexture(assets.textures.skins); // TODO: extend to nearby bodies as well for (auto c : cam.Reference().Creatures()) { - assets.shaders.creature_skin.SetM(cam.Model(c->GetBody()) * glm::mat4(c->LocalTransform())); - c->Draw(assets, viewport); + 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()); + c->Draw(viewport); } viewport.ClearDepth();