]> git.localhorst.tv Git - blobs.git/blobdiff - src/app/states.cpp
creature skin overhaul
[blobs.git] / src / app / states.cpp
index d98a0991cbc67c4ec2dbb9c0c68030d2cfc1bb87..b1a20db92a50740934dfac6849065940c84e4ab6 100644 (file)
@@ -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
@@ -125,6 +135,8 @@ void MasterState::OnRender(graphics::Viewport &viewport) {
        // 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());
                c->Draw(viewport);
        }