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));
}
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
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();