diff options
author | makamys <makamys@outlook.com> | 2021-05-07 14:30:26 +0200 |
---|---|---|
committer | makamys <makamys@outlook.com> | 2021-05-07 14:30:26 +0200 |
commit | 77cd6075160cd2d90f1d587fcafcc9f8803185a1 (patch) | |
tree | e260eba611da8b4944b38cc0f562412ae2437f9c /src | |
parent | 8d34032cdf6ba6bb85e61864545bb606afff1f9f (diff) | |
download | Neodymium-77cd6075160cd2d90f1d587fcafcc9f8803185a1.tar.gz Neodymium-77cd6075160cd2d90f1d587fcafcc9f8803185a1.tar.bz2 Neodymium-77cd6075160cd2d90f1d587fcafcc9f8803185a1.zip |
Add VRAM meter to F3 overlay
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/makamys/lodmod/LODMod.java | 20 | ||||
-rw-r--r-- | src/main/java/makamys/lodmod/renderer/LODRenderer.java | 4 |
2 files changed, 24 insertions, 0 deletions
diff --git a/src/main/java/makamys/lodmod/LODMod.java b/src/main/java/makamys/lodmod/LODMod.java index 66642c0..6b0e2c7 100644 --- a/src/main/java/makamys/lodmod/LODMod.java +++ b/src/main/java/makamys/lodmod/LODMod.java @@ -1,5 +1,11 @@ package makamys.lodmod; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraftforge.client.event.RenderGameOverlayEvent; +import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.world.WorldEvent; @@ -62,4 +68,18 @@ public class LODMod renderer.serverTick(); } } + + @SubscribeEvent + public void onRenderOverlay(RenderGameOverlayEvent event) { + FontRenderer fontRenderer = RenderManager.instance.getFontRenderer(); + if(isActive() && event.type == ElementType.TEXT && fontRenderer != null && Minecraft.getMinecraft().gameSettings.showDebugInfo) + { + Minecraft mc = Minecraft.getMinecraft(); + ScaledResolution scaledresolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight); + int w = scaledresolution.getScaledWidth(); + int h = scaledresolution.getScaledHeight(); + String s = renderer.getDebugText(); + fontRenderer.drawStringWithShadow(s, w - fontRenderer.getStringWidth(s) - 10, 80, 0xFFFFFF); + } + } } diff --git a/src/main/java/makamys/lodmod/renderer/LODRenderer.java b/src/main/java/makamys/lodmod/renderer/LODRenderer.java index b8121ed..2295848 100644 --- a/src/main/java/makamys/lodmod/renderer/LODRenderer.java +++ b/src/main/java/makamys/lodmod/renderer/LODRenderer.java @@ -492,6 +492,10 @@ public class LODRenderer { return null; } + public String getDebugText() { + return "VRAM: " + (nextMeshOffset / 1024 / 1024) + "MB / " + (BUFFER_SIZE / 1024 / 1024) + "MB"; + } + public static class LODChunkComparator implements Comparator<LODChunk> { Entity player; |