+
+ // debug overlay
+ counter_text.Position(glm::vec3(-25.0f, 25.0f, 0.0f), Gravity::NORTH_EAST);
+ counter_text.Foreground(glm::vec4(1.0f));
+ counter_text.Background(glm::vec4(0.5f));
+ position_text.Position(glm::vec3(-25.0f, 25.0f + ls, 0.0f), Gravity::NORTH_EAST);
+ position_text.Foreground(glm::vec4(1.0f));
+ position_text.Background(glm::vec4(0.5f));
+ orientation_text.Position(glm::vec3(-25.0f, 25.0f + 2 * ls, 0.0f), Gravity::NORTH_EAST);
+ orientation_text.Foreground(glm::vec4(1.0f));
+ orientation_text.Background(glm::vec4(0.5f));
+ block_text.Position(glm::vec3(-25.0f, 25.0f + 4 * ls, 0.0f), Gravity::NORTH_EAST);
+ block_text.Foreground(glm::vec4(1.0f));
+ block_text.Background(glm::vec4(0.5f));
+ block_text.Set(env.assets.small_ui_font, "Block: none");
+ entity_text.Position(glm::vec3(-25.0f, 25.0f + 4 * ls, 0.0f), Gravity::NORTH_EAST);
+ entity_text.Foreground(glm::vec4(1.0f));
+ entity_text.Background(glm::vec4(0.5f));
+ entity_text.Set(env.assets.small_ui_font, "Entity: none");
+
+ // net stats
+ bandwidth_text.Position(glm::vec3(-25.0f, 25.0f + 6 * ls, 0.0f), Gravity::NORTH_EAST);
+ bandwidth_text.Foreground(glm::vec4(1.0f));
+ bandwidth_text.Background(glm::vec4(0.5f));
+ bandwidth_text.Set(env.assets.small_ui_font, "TX: 0.0KB/s RX: 0.0KB/s");
+ rtt_text.Position(glm::vec3(-25.0f, 25.0f + 7 * ls, 0.0f), Gravity::NORTH_EAST);
+ rtt_text.Foreground(glm::vec4(1.0f));
+ rtt_text.Background(glm::vec4(0.5f));
+ rtt_text.Set(env.assets.small_ui_font, "RTT: unavailable");
+ packet_loss_text.Position(glm::vec3(-25.0f, 25.0f + 8 * ls, 0.0f), Gravity::NORTH_EAST);
+ packet_loss_text.Foreground(glm::vec4(1.0f));
+ packet_loss_text.Background(glm::vec4(0.5f));
+ packet_loss_text.Set(env.assets.small_ui_font, "Packet loss: 0.0%");
+
+ // message box
+ messages.Position(glm::vec3(25.0f, -25.0f - 2 * ls, 0.0f), Gravity::SOUTH_WEST);
+ messages.Foreground(glm::vec4(1.0f));
+ messages.Background(glm::vec4(0.5f));
+
+ // crosshair
+ PrimitiveMesh::Buffer buf;
+ buf.vertices = std::vector<glm::vec3>({
+ { -10.0f, 0.0f, 0.0f }, { 10.0f, 0.0f, 0.0f },
+ { 0.0f, -10.0f, 0.0f }, { 0.0f, 10.0f, 0.0f },
+ });
+ buf.indices = std::vector<PrimitiveMesh::Index>({
+ 0, 1, 2, 3
+ });
+ buf.colors.resize(4, { 10.0f, 10.0f, 10.0f, 1.0f });
+ crosshair.Update(buf);
+}
+
+namespace {
+
+PrimitiveMesh::Buffer outl_buf;
+
+}
+
+void HUD::FocusBlock(const Chunk &chunk, int index) {
+ const Block &block = chunk.BlockAt(index);
+ const BlockType &type = chunk.Type(index);
+ outl_buf.Clear();
+ type.OutlinePrimitiveMesh(outl_buf);
+ outline.Update(outl_buf);
+ outline_transform = chunk.Transform(player.GetEntity().ChunkCoords());
+ outline_transform *= chunk.ToTransform(Chunk::ToPos(index), index);
+ outline_transform *= glm::scale(glm::vec3(1.005f));
+ outline_visible = true;
+ {
+ std::stringstream s;
+ s << "Block: "
+ << type.label
+ << ", face: " << block.GetFace()
+ << ", turn: " << block.GetTurn();
+ block_text.Set(env.assets.small_ui_font, s.str());
+ }
+ show_block = true;
+ show_entity = false;
+}
+
+void HUD::FocusEntity(const Entity &entity) {
+ {
+ std::stringstream s;
+ s << "Entity: " << entity.Name();
+ entity_text.Set(env.assets.small_ui_font, s.str());
+ }
+ show_block = false;
+ show_entity = true;